From f0bada71d3ff0e2e21f683ba1652e53157112396 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 18 Aug 2021 21:27:43 +0000 Subject: [PATCH] extrasyn: Add highlighters for JSON, Verilog, VHDL. Kindly provided by MRisco, issue #18248. Shorten menu in demo program. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8075 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../syneditstrconstextra.pas | 7 + .../synhighlighterjson.pas | 694 ++++++++++ .../synhighlightertcltk.pas | 252 +--- .../synhighlighterverilog.pas | 985 +++++++++++++++ .../synhighlightervhdl.pas | 1120 +++++++++++++++++ .../TestHighlighters/TestSynHighlighter.lpi | 544 ++++---- .../extrasyn/TestHighlighters/unit1.lfm | 12 +- .../extrasyn/TestHighlighters/unit1.pas | 20 +- components/extrasyn/extrahighlighters.lpk | 19 +- components/extrasyn/extrahighlighters.pas | 3 +- .../extrasyn/extrahighlighters_dsgn.lpk | 5 +- components/extrasyn/icons/iconlist.txt | 10 + components/extrasyn/icons/tsynjsonsyn.png | Bin 0 -> 583 bytes components/extrasyn/icons/tsynjsonsyn_150.png | Bin 0 -> 866 bytes components/extrasyn/icons/tsynjsonsyn_200.png | Bin 0 -> 1023 bytes components/extrasyn/icons/tsynverilogsyn.png | Bin 0 -> 527 bytes .../extrasyn/icons/tsynverilogsyn_150.png | Bin 0 -> 746 bytes .../extrasyn/icons/tsynverilogsyn_200.png | Bin 0 -> 855 bytes components/extrasyn/icons/tsynvhdlsyn.png | Bin 0 -> 536 bytes components/extrasyn/icons/tsynvhdlsyn_150.png | Bin 0 -> 734 bytes components/extrasyn/icons/tsynvhdlsyn_200.png | Bin 0 -> 879 bytes components/extrasyn/images.res | Bin 105079 -> 112379 bytes components/extrasyn/uhighlighterreg.pas | 6 + 23 files changed, 3215 insertions(+), 462 deletions(-) create mode 100644 components/extrasyn/SyneditHighlighters/synhighlighterjson.pas create mode 100644 components/extrasyn/SyneditHighlighters/synhighlighterverilog.pas create mode 100644 components/extrasyn/SyneditHighlighters/synhighlightervhdl.pas create mode 100644 components/extrasyn/icons/tsynjsonsyn.png create mode 100644 components/extrasyn/icons/tsynjsonsyn_150.png create mode 100644 components/extrasyn/icons/tsynjsonsyn_200.png create mode 100644 components/extrasyn/icons/tsynverilogsyn.png create mode 100644 components/extrasyn/icons/tsynverilogsyn_150.png create mode 100644 components/extrasyn/icons/tsynverilogsyn_200.png create mode 100644 components/extrasyn/icons/tsynvhdlsyn.png create mode 100644 components/extrasyn/icons/tsynvhdlsyn_150.png create mode 100644 components/extrasyn/icons/tsynvhdlsyn_200.png diff --git a/components/extrasyn/SyneditHighlighters/syneditstrconstextra.pas b/components/extrasyn/SyneditHighlighters/syneditstrconstextra.pas index 88ae442a4..67da0a989 100644 --- a/components/extrasyn/SyneditHighlighters/syneditstrconstextra.pas +++ b/components/extrasyn/SyneditHighlighters/syneditstrconstextra.pas @@ -198,6 +198,10 @@ ResourceString SYNS_FilterLDraw = 'LEGO LDraw Files (*.ldr)|*.ldr'; SYNS_FilterLua = 'Lua Script File (*.Lua)|*.Lua'; SYNS_FilterProlog = 'Prolog Files (*.pl;*.pro;*.prl)|*.pl;*.pro;*.prl'; + SYNS_FilterVHDL = 'VHDL Files (*.vhd;*.vhdl)|*.vhd;*.vhdl'; + SYNS_FilterVerilog = 'Verilog Files (*.v;*.vl;*.ver)|*.v;*.vl;*.ver'; + SYNS_FilterJSON = 'JSON Files (*.json)|*.json'; + //SYNS_FilterX86Assembly = 'x86 Assembly Files (*.asm)|*.asm'; //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'; @@ -265,6 +269,9 @@ ResourceString SYNS_LangLua = 'Lua Script'; SYNS_Lang8051 = '8051 Assembler'; SYNS_LangProlog = 'Prolog'; + SYNS_LangVHDL = 'VHDL'; + SYNS_LangVerilog = 'Verilog'; + SYNS_LangJSON = 'JSON'; //SYNS_LangHP48 = 'HP48'; //SYNS_LangCAClipper = 'CA-Clipper'; //SYNS_LangCPM = 'COAS Product Manager Report'; diff --git a/components/extrasyn/SyneditHighlighters/synhighlighterjson.pas b/components/extrasyn/SyneditHighlighters/synhighlighterjson.pas new file mode 100644 index 000000000..0a72c915e --- /dev/null +++ b/components/extrasyn/SyneditHighlighters/synhighlighterjson.pas @@ -0,0 +1,694 @@ +{------------------------------------------------------------------------------- +SynHighlighterJSON v1.1 + +This unit provides a SBA JSON highlighter for SynEdit. + +(c) Miguel A. Risco-Castillo + +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. + +Some concepts in this unit are based in the Original Code of Zhou Kan and +"La Biblia del SynEdit" of Tito Hinostroza. +All Rights Reserved. + +v1.1 2019/12/21 +Adapted to extrasyn package + +v1.0 2016 +Initial + +-------------------------------------------------------------------------------} + +unit SynHighlighterJSON; + +// extrasyn.inc is the synedit.inc from laz 1.2.0 synedit package source, +// If it has changed in newer version you might need to copy it again. +// Remember to redclare the syn_lazarus define. +{$I extrasyn.inc} +{$H+} + +interface + +uses + SysUtils, Classes, Graphics, SynEditStrConstExtra, SynEditHighlighterFoldBase, SynEditHighlighter, SynEditTypes, SynEditStrConst; + +type +// TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, +// tkNumber, tkSpace, tkString, tkSymbol, tkAttribute, tkUnknown); + +// TRangeState = (rsUnknown, rsComment); + + TtkTokenKind = (tkKey, tkString, tkReserved, tkNull, tkNumber, tkSpace, + tkSymbol, tkUnknown); + + TRangeState = (rsUnknown, rsAttribute, rsObjectValue, rsArrayValue); + + TProcTableProc = procedure of object; + +type + + { TSynJSONSyn } + + TSynJSONSyn = class(TSynCustomFoldHighlighter) + private + FHLWordsList: TStringList; + fRange: TRangeState; + fLine: PChar; + fLineNumber: integer; + fProcTable: array[#0..#255] of TProcTableProc; + Run: longint; + fStringLen: integer; + fToIdent: PChar; + fTokenPos: integer; + FTokenID: TtkTokenKind; + FValueAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighLighterAttributes; + fKeyAttri: TSynHighLighterAttributes; + fNumberAttri: TSynHighLighterAttributes; + fSpaceAttri: TSynHighLighterAttributes; + fSymbolAttri: TSynHighLighterAttributes; + fAttribAttri: TSynHighLighterAttributes; + fDivider:TSynDividerDrawConfigSetting; + procedure CloseArrayProc; + procedure CloseObjectProc; + procedure CommaProc; + function KeyComp(const aKey: string): boolean; + procedure OpenArrayProc; + procedure OpenObjectProc; + procedure SetHLWordsList(AValue: TStringList); + procedure SymbolsProc; + procedure CRProc; + procedure ColonProc; + procedure EqualProc; + procedure EndTokenProc; + 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 RoundCloseProc; + procedure RoundOpenProc; + procedure SemiColonProc; + procedure SlashProc; + procedure SpaceProc; + procedure StarProc; + procedure StringProc; + procedure UnknownProc; + procedure FoldValidProc; + procedure MakeMethodTables; + protected + function GetIdentChars: TSynIdentChars; override; + function GetSampleSource: string; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: integer): TSynHighLighterAttributes; + override; + function GetEOL: boolean; override; + function GetTokenID: TtkTokenKind; + procedure SetLine(const NewValue: String; LineNumber:Integer); override; + function GetToken: string; override; + procedure GetTokenEx(out TokenStart: PChar; out TokenLength: integer); override; + function GetTokenAttribute: TSynHighLighterAttributes; override; + function GetTokenKind: integer; override; + function GetTokenPos: integer; override; + procedure Next; override; + function GetRange: Pointer; override; + procedure SetRange(Value: Pointer); override; + procedure ReSetRange; override; + function GetDrawDivider(Index: integer): TSynDividerDrawConfigSetting; override; + property IdentChars; + class function GetLanguageName: string; override; + published + 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 SymbolAttri: TSynHighLighterAttributes read fSymbolAttri write fSymbolAttri; + property AttribAttri: TSynHighLighterAttributes read fAttribAttri write fAttribAttri; + property ValueAttri: TSynHighLighterAttributes read fValueAttri write fValueAttri; + property HLWordsList: TStringList read FHLWordsList write SetHLWordsList; + end; + +implementation + +var + Identifiers: array[#0..#255] of bytebool; + mHashTable: array[#0..#255] of integer; + +procedure MakeIdentTable; +var + I, J: char; +begin + for I := #0 to #255 do + begin + case I of + '_', '0'..'9', 'a'..'z', 'A'..'Z': Identifiers[I] := True; + else + Identifiers[I] := False; + end; + J := I; //UpCase(I); In verilog the keywords are in lower case + case I in ['_', '0'..'9', 'A'..'Z', 'a'..'z'] of + True: mHashTable[I] := Ord(J) + else + mHashTable[I] := 0; + end; + end; +end; + +function TSynJSONSyn.KeyComp(const aKey: string): boolean; +var + I: integer; + Temp: PChar; +begin + Temp := fToIdent; // Test from the second char +1 + if Length(aKey) = fStringLen then + begin + Result := True; + for i := 1 to fStringLen do // Test from the second char := 2 + begin + if mHashTable[Temp^] <> mHashTable[aKey[i]] then + begin + Result := False; + break; + end; + inc(Temp); + end; + end + else + Result := False; +end; + +procedure TSynJSONSyn.SetHLWordsList(AValue: TStringList); +begin + if FHLWordsList=AValue then Exit; + FHLWordsList:=AValue; +end; + +procedure TSynJSONSyn.IdentProc; +var i:integer; +begin + while Identifiers[fLine[Run]] do inc(Run); + fStringLen:=Run-fTokenPos; + fToIdent:=fLine + fTokenPos; + fTokenID := tkUnknown; + if FHLWordsList.Count>0 then for i:=0 to FHLWordsList.Count-1 do + begin + if KeyComp(FHLWordsList[i]) then fTokenID := tkString; + end; + //sba json + case Upcase(fToIdent^) of + 'A':begin + if KeyComp('author') + then fTokenID := tkKey; + end; + 'D':begin + if KeyComp('date') or + KeyComp('description') + then fTokenID := tkKey; + end; + 'E':begin + if KeyComp('explibfiles') or + KeyComp('expmonolithic') or + KeyComp('exportpath') + then fTokenID := tkKey; + end; + 'F':begin + if KeyComp('false') + then fTokenID := tkKey; + end; + 'I':begin + if KeyComp('interface') or + KeyComp('ipcores') + then fTokenID := tkKey; + end; + 'L':begin + if KeyComp('location') + then fTokenID := tkKey; + end; + 'N':begin + if KeyComp('name') or + KeyComp('null') + then fTokenID := tkKey; + end; + 'P':begin + if KeyComp('portname') + then fTokenID := tkKey; + //if KeyComp('process') or + // KeyComp('package') then begin fTokenID := tkKey; StartCodeFoldBlock(nil); end; + //if KeyComp('procedure') then begin fTokenID := tkKey; FoldValidProc; end; + end; + 'T':begin + if KeyComp('title') or + KeyComp('true') + then fTokenID := tkKey; + end; + 'U':begin + if KeyComp('userfiles') + then fTokenID := tkKey; + end; + 'V':begin + if KeyComp('version') then fTokenID := tkKey; + end; + end; +end; + +procedure TSynJSONSyn.MakeMethodTables; +var + I: char; +begin + for I := #0 to #255 do + case I of + #0 : fProcTable[I] := @NullProc; + '#','$','&','@' : fProcTable[I] := @SymbolsProc; + 'A'..'Z', 'a'..'z', '_': fProcTable[I] := @IdentProc; + '{': fProcTable[I] := @OpenObjectProc; + '}': fProcTable[I] := @CloseObjectProc; + '[': fProcTable[I] := @OpenArrayProc; + ']': fProcTable[I] := @CloseArrayProc; + ',': fProcTable[I] := @CommaProc; + ':': fProcTable[I] := @ColonProc; + '=': fProcTable[I] := @EqualProc; + '>': fProcTable[I] := @GreaterProc; + #10: fProcTable[I] := @LFProc; + #13: fProcTable[I] := @CRProc; + '<': fProcTable[I] := @LowerProc; + '%': fProcTable[I] := @ModSymbolProc; + '!': fProcTable[I] := @NotSymbolProc; + '0'..'9','-': fProcTable[I] := @NumberProc; + '|': fProcTable[I] := @OrSymbolProc; + '+': fProcTable[I] := @PlusProc; + '*': fProcTable[I] := @StarProc; + '/': fProcTable[I] := @SlashProc; + '.': fProcTable[I] := @PointProc; + ')': fProcTable[I] := @RoundCloseProc; + '(': fProcTable[I] := @RoundOpenProc; + ';': fProcTable[I] := @SemiColonProc; + #1..#9, #11, #12, #14..#32: fProcTable[I] := @SpaceProc; + '"': fProcTable[I] := @StringProc; //" #34 + else + fProcTable[I] := @UnknownProc; + end; +end; + +constructor TSynJSONSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier); + fIdentifierAttri.Foreground := clWindowText; + AddAttribute(fIdentifierAttri); + + fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord); + fKeyAttri.Foreground := clBlue; + AddAttribute(fKeyAttri); + + fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber); + fNumberAttri.Foreground := clRed; + AddAttribute(fNumberAttri); + + fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrWhitespace); + AddAttribute(fSpaceAttri); + + fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol); + fSymbolAttri.Foreground := clTeal; + AddAttribute(fSymbolAttri); + + fAttribAttri := TSynHighLighterAttributes.Create(SYNS_AttrAttributeName); + fAttribAttri.Foreground := clPurple; // clMaroon; + AddAttribute(fAttribAttri); + + FValueAttri := TSynHighlighterAttributes.Create(SYNS_AttrValue); + FValueAttri.Foreground := clNavy; + AddAttribute(FValueAttri); + + SetAttributesOnChange(@DefHighlightChange); + MakeMethodTables; + fRange := rsUnknown; + fDefaultFilter := SYNS_FilterJSON; + + fDivider.Color:=clNone; + FHLWordsList:=TStringList.Create; +end; + +destructor TSynJSONSyn.Destroy; +begin + FreeAndNil(FHLWordsList); + inherited Destroy; +end; + +procedure TSynJSONSyn.SetLine(const NewValue: String; LineNumber: Integer); +begin + inherited; + fLine := PChar(NewValue); + Run := 0; + fLineNumber := LineNumber; + Next; +end; + +procedure TSynJSONSyn.CloseArrayProc; +begin + SymbolsProc; + FRange := rsUnknown; +end; + +procedure TSynJSONSyn.CloseObjectProc; +begin + SymbolsProc; + FRange := rsUnknown; +end; + +procedure TSynJSONSyn.ColonProc; +begin + SymbolsProc; + FRange := rsObjectValue; +end; + +procedure TSynJSONSyn.CommaProc; +begin + SymbolsProc; + if FRange = rsObjectValue then + FRange := rsAttribute; +end; + +procedure TSynJSONSyn.SymbolsProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynJSONSyn.CRProc; +begin + fTokenID := tkSpace; + Inc(Run); + if fLine[Run + 1] = #10 then Inc(Run); +end; + +procedure TSynJSONSyn.EqualProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.GreaterProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.LFProc; +begin + fTokenID := tkSpace; + inc(Run); +end; + +procedure TSynJSONSyn.LowerProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.MinusProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.SlashProc; +begin + fTokenID := tkSymbol; + inc(Run); +end; + +procedure TSynJSONSyn.ModSymbolProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynJSONSyn.NotSymbolProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.NullProc; +begin + fTokenID := tkNull; +end; + +procedure TSynJSONSyn.NumberProc; +begin + fTokenID := tkNumber; + while FLine[Run] in ['0'..'9','.','-','+','e','E'] do + inc(Run); +end; + +procedure TSynJSONSyn.OpenArrayProc; +begin + SymbolsProc; + FRange := rsArrayValue; +end; + +procedure TSynJSONSyn.OpenObjectProc; +begin + SymbolsProc; + FRange := rsAttribute; +end; + +procedure TSynJSONSyn.OrSymbolProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynJSONSyn.PlusProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.PointProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.RoundCloseProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.RoundOpenProc; +begin + inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.SemiColonProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.SpaceProc; +begin + inc(Run); + fTokenID := tkSpace; + while FLine[Run] in [#1..#9, #11, #12, #14..#32] do inc(Run); +end; + +procedure TSynJSONSyn.StarProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynJSONSyn.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 TSynJSONSyn.EndTokenProc; +begin + fTokenID := tkKey; + EndCodeFoldBlock(); +end; + +procedure TSynJSONSyn.UnknownProc; +begin + inc(Run); + while (fLine[Run] in [#128..#191]) OR // continued utf8 subcode + ((fLine[Run]<>#0) and (fProcTable[fLine[Run]] = @UnknownProc)) do inc(Run); + fTokenID := tkUnknown; +end; + +procedure TSynJSONSyn.FoldValidProc; +var + tmp:integer; + found:boolean; +begin + tmp:=run; + found:=false; + while (not (fLine[tmp] in [#0, #10, #13])) do if fLine[tmp]=';' then + begin + found:=true; + break; + end else inc(tmp); + if not found then StartCodeFoldBlock(nil); +end; + +procedure TSynJSONSyn.Next; +begin + fTokenPos := Run; +// if fRange = rsComment then CommentProc else + fProcTable[fLine[Run]]; +end; + +function TSynJSONSyn.GetDefaultAttribute(Index: integer): TSynHighLighterAttributes; +begin + case Index of + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fValueAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; + else + Result := nil; + end; +end; + +function TSynJSONSyn.GetEOL: boolean; +begin + Result := fTokenID = tkNull; +end; + +function TSynJSONSyn.GetToken: string; +var + Len: longint; +begin + Len := Run - fTokenPos; + SetString(Result, (FLine + fTokenPos), Len); +end; + +procedure TSynJSONSyn.GetTokenEx(out TokenStart: PChar; out TokenLength: integer); +begin + TokenLength:=Run-fTokenPos; + TokenStart := fLine + fTokenPos; +end; + +function TSynJSONSyn.GetTokenID: TtkTokenKind; +begin + Result := fTokenId; +end; + +function TSynJSONSyn.GetTokenAttribute: TSynHighLighterAttributes; +begin + case GetTokenID of + tkString: + if FRange in [rsObjectValue, rsArrayValue] then + Result := FValueAttri + else + Result := fAttribAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynJSONSyn.GetTokenKind: integer; +begin + Result := Ord(fTokenId); +end; + +function TSynJSONSyn.GetTokenPos: integer; +begin + Result := fTokenPos; +end; + +function TSynJSONSyn.GetRange: Pointer; +begin +// Result := Pointer(fRange); + CodeFoldRange.RangeType := Pointer(PtrInt(fRange)); + Result := inherited; +end; + +procedure TSynJSONSyn.ReSetRange; +begin + inherited; + fRange := rsUnknown; +end; + +function TSynJSONSyn.GetDrawDivider(Index: integer + ): TSynDividerDrawConfigSetting; +begin + Result:=fDivider; +end; + +procedure TSynJSONSyn.SetRange(Value: Pointer); +begin + // fRange := TRangeState(Value); + inherited; + fRange := TRangeState(PtrUInt(CodeFoldRange.RangeType)); +end; + +function TSynJSONSyn.GetIdentChars: TSynIdentChars; +begin + Result := ['_', '0'..'9', 'a'..'z', 'A'..'Z']; +end; + +class function TSynJSONSyn.GetLanguageName :string; +begin + Result := SYNS_LangJSON; +end; + +function TSynJSONSyn.GetSampleSource: string; +begin + Result := + '{"menu": {'+LineEnding+ + ' "id": "file",'+LineEnding+ + ' "value": "File",'+LineEnding+ + ' "popup": {'+LineEnding+ + ' "menuitem": ['+LineEnding+ + ' {"value": "New", "onclick": "CreateNewDoc()"},'+LineEnding+ + ' {"value": "Open", "onclick": "OpenDoc()"},'+LineEnding+ + ' {"value": "Close", "onclick": "CloseDoc()"}'+LineEnding+ + ' ]'+LineEnding+ + ' }'+LineEnding+ + '}}'; +end; + +initialization + MakeIdentTable; + RegisterPlaceableHighlighter(TSynJSONSyn); + +end. + diff --git a/components/extrasyn/SyneditHighlighters/synhighlightertcltk.pas b/components/extrasyn/SyneditHighlighters/synhighlightertcltk.pas index 3545db56e..479a4c3b2 100644 --- a/components/extrasyn/SyneditHighlighters/synhighlightertcltk.pas +++ b/components/extrasyn/SyneditHighlighters/synhighlightertcltk.pas @@ -27,7 +27,7 @@ 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.19 2005/01/28 16:53:25 maelh Exp $ +$Id: SynHighlighterTclTk.pas,v 1.20 2019/06/06 16:53:25 maelh Exp $ You may retrieve the latest version of this file at the SynEdit home page, located at http://SynEdit.SourceForge.net @@ -38,7 +38,7 @@ 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) +@lastmod(2019/06/06) MOD by M.A.R.C. for SBACreator The SynHighlighterTclTk unit provides SynEdit with a TCL/Tk highlighter. } @@ -62,6 +62,7 @@ uses {$ELSE} Graphics, SynEditHighlighter, + SynEditHighlighterFoldBase, {$ENDIF} SysUtils, Classes; @@ -70,12 +71,16 @@ type TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSecondKey, tkSpace, tkString, tkSymbol, tkUnknown); - TRangeState = (rsUnknown, rsAnsi, rsPasStyle, rsCStyle); + TRangeState = (rsUnknown); TProcTableProc = procedure of object; + TBlockID = ( + BodyBlk + ); + type - TSynTclTkSyn = class(TSynCustomHighlighter) + TSynTclTkSyn = class(TSynCustomFoldHighlighter) private fRange: TRangeState; fLine: PChar; @@ -95,6 +100,7 @@ type fKeyWords: TStrings; fSecondKeys: TStrings; procedure BraceOpenProc; + procedure BraceCloseProc; procedure PointCommaProc; procedure CRProc; procedure IdentProc; @@ -102,14 +108,12 @@ type procedure NullProc; procedure NumberProc; procedure RoundOpenProc; + procedure HashProc; procedure SlashProc; procedure SpaceProc; procedure StringProc; procedure UnknownProc; procedure MakeMethodTables; - procedure AnsiProc; - procedure PasStyleProc; - procedure CStyleProc; procedure SetKeyWords(const Value: TStrings); procedure SetSecondKeys(const Value: TStrings); function IsKeywordListStored: boolean; @@ -209,15 +213,15 @@ begin for I := #0 to #255 do begin case I of - '_', '0'..'9', 'a'..'z', 'A'..'Z': - Identifiers[I] := True; + '_', '0'..'9', 'a'..'z', 'A'..'Z': Identifiers[I] := True; else Identifiers[I] := False; end; J := UpCase(I); - case I in ['_', 'a'..'z', 'A'..'Z'] of - True: mHashTable[I] := Ord(J) - 64 - else mHashTable[I] := 0; + case I in ['_', '0'..'9', 'A'..'Z', 'a'..'z'] of + True: mHashTable[I] := Ord(J) + else + mHashTable[I] := 0; end; end; end; @@ -274,18 +278,19 @@ var begin for I := #0 to #255 do case I of - '#': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} SlashProc; - '{': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} BraceOpenProc; - ';': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} PointCommaProc; - #13: fProcTable[I] := {$IFDEF FPC}@{$ENDIF} CRProc; - 'A'..'Z', 'a'..'z', '_': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} IdentProc; - #10: fProcTable[I] := {$IFDEF FPC}@{$ENDIF} LFProc; #0: fProcTable[I] := {$IFDEF FPC}@{$ENDIF} NullProc; - '0'..'9': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} NumberProc; + '#': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} HashProc; + '{': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} BraceOpenProc; + '}': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} BraceCloseProc; + ';': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} PointCommaProc; '(': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} RoundOpenProc; + '"': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} StringProc; '/': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} SlashProc; + #10: fProcTable[I] := {$IFDEF FPC}@{$ENDIF} LFProc; + #13: fProcTable[I] := {$IFDEF FPC}@{$ENDIF} CRProc; + '0'..'9': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} NumberProc; + 'A'..'Z', 'a'..'z', '_': fProcTable[I] := {$IFDEF FPC}@{$ENDIF} IdentProc; #1..#9, #11, #12, #14..#32: fProcTable[I] := {$IFDEF FPC}@{$ENDIF} SpaceProc; - #34: fProcTable[I] := {$IFDEF FPC}@{$ENDIF} StringProc; else fProcTable[I] := {$IFDEF FPC}@{$ENDIF} UnknownProc; end; @@ -348,129 +353,27 @@ end; procedure TSynTclTkSyn.SetLine(const NewValue: String; LineNumber:Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; Next; end; { SetLine } -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 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 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 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 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 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 TSynTclTkSyn.BraceOpenProc; begin inc(Run); fTokenID := tkSymbol; + StartCodeFoldBlock(Pointer(PtrUInt(BodyBlk))); +end; + +procedure TSynTclTkSyn.BraceCloseProc; +var Blk:TBlockID; +begin + blk:=TBlockID(PtrUInt(TopCodeFoldBlockType)); + if blk=BodyBlk then EndCodeFoldBlock(); + inc(Run); + fTokenID := tkSymbol; end; procedure TSynTclTkSyn.PointCommaProc; @@ -482,10 +385,8 @@ end; procedure TSynTclTkSyn.CRProc; begin fTokenID := tkSpace; - Case FLine[Run + 1] of - #10: inc(Run, 2); - else inc(Run); - end; + Inc(Run); + if fLine[Run + 1] = #10 then Inc(Run); end; procedure TSynTclTkSyn.IdentProc; @@ -494,8 +395,7 @@ begin if IsKeyWord(GetToken) then begin fTokenId := tkKey; Exit; - end - else fTokenId := tkIdentifier; + end else fTokenId := tkIdentifier; if IsSecondKeyWord(GetToken) then fTokenId := tkSecondKey else fTokenId := tkIdentifier; @@ -516,7 +416,7 @@ procedure TSynTclTkSyn.NumberProc; begin inc(Run); fTokenID := tkNumber; - while FLine[Run] in ['0'..'9', '.', 'e', 'E'] do + while FLine[Run] in ['0'..'9', '.', 'a'..'f', 'A'..'F', 'x', 'X'] do begin case FLine[Run] of '.': @@ -532,38 +432,22 @@ begin fTokenId := tkSymbol; end; +procedure TSynTclTkSyn.HashProc; +begin + fTokenID := tkComment; + while FLine[Run] <> #0 do + begin + case FLine[Run] of + #10, #13: break; + end; + inc(Run); + end; +end; + procedure TSynTclTkSyn.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 - 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; + inc(Run); + fTokenID := tkSymbol; end; procedure TSynTclTkSyn.SpaceProc; @@ -594,20 +478,18 @@ begin Inc(Run, 2) else {$ENDIF} +// inc(Run); +// fTokenID := tkUnKnown; inc(Run); - fTokenID := tkUnKnown; + while (fLine[Run] in [#128..#191]) OR // continued utf8 subcode + ((fLine[Run]<>#0) and (fProcTable[fLine[Run]] = @UnknownProc)) do inc(Run); + fTokenID := tkUnknown; end; procedure TSynTclTkSyn.Next; begin fTokenPos := Run; - case fRange of - rsAnsi: AnsiProc; - rsPasStyle: PasStyleProc; - rsCStyle: CStyleProc; - else - fProcTable[fLine[Run]]; - end; + fProcTable[fLine[Run]]; end; function TSynTclTkSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; @@ -626,13 +508,13 @@ end; function TSynTclTkSyn.GetEol: Boolean; begin - Result := False; - if fTokenId = tkNull then Result := True; + Result := fTokenID = tkNull; end; function TSynTclTkSyn.GetRange: Pointer; begin - Result := Pointer(PtrInt(fRange)); + CodeFoldRange.RangeType := Pointer(PtrInt(fRange)); + Result := inherited; end; function TSynTclTkSyn.GetToken: string; @@ -677,12 +559,15 @@ end; procedure TSynTclTkSyn.ResetRange; begin + inherited; fRange := rsUnknown; end; procedure TSynTclTkSyn.SetRange(Value: Pointer); begin - fRange := TRangeState(PtrUInt(Value)); +// fRange := TRangeState(PtrUInt(Value)); + inherited; + fRange := TRangeState(PtrUInt(CodeFoldRange.RangeType)); end; procedure TSynTclTkSyn.SetKeyWords(const Value: TStrings); @@ -770,7 +655,8 @@ begin iIndex := 0; for cDefKey := Low(TclTkKeys) to High(TclTkKeys) do begin - if not iKeys.Find( TclTkKeys[cDefKey], iIndex ) then + iIndex:=iKeys.IndexOf(TclTkKeys[cDefKey]); + if iIndex=-1 then begin Result := True; Exit; diff --git a/components/extrasyn/SyneditHighlighters/synhighlighterverilog.pas b/components/extrasyn/SyneditHighlighters/synhighlighterverilog.pas new file mode 100644 index 000000000..40cba58a2 --- /dev/null +++ b/components/extrasyn/SyneditHighlighters/synhighlighterverilog.pas @@ -0,0 +1,985 @@ +{------------------------------------------------------------------------------- +SynHighlighterVerilog v1.2 + +This unit provides a Verilog highlighter for SynEdit. + +2015 (c) Miguel A. Risco-Castillo + +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. + +Some concepts in this unit are based in the Original Code of Zhou Kan and +"La Biblia del SynEdit" of Tito Hinostroza. +All Rights Reserved. + +v1.2 2019/12/21 +Adapted to extrasyn package + +v1.1 2015 +Add special list of highlighted words + +-------------------------------------------------------------------------------} + +unit synhighlighterverilog; + +// extrasyn.inc is the synedit.inc from laz 1.2.0 synedit package source, +// If it has changed in newer version you might need to copy it again. +// Remember to redclare the syn_lazarus define. +{$I extrasyn.inc} +{$H+} + +interface + +uses + SysUtils, Classes, Graphics, SynEditStrConstExtra, SynEditHighlighterFoldBase, SynEditHighlighter, SynEditTypes, SynEditStrConst; + +type + TtkTokenKind = (tkSBA, tkIeee, tkComment, tkIdentifier, tkKey, tkNull, + tkNumber, tkSpace, tkString, tkSymbol, tkAttribute, tkUnknown); + + TRangeState = (rsUnknown, rsComment); + + TProcTableProc = procedure of object; + +type + + { TSynVerilogSyn } + + TSynVerilogSyn = class(TSynCustomFoldHighlighter) + private + FHLWordsList: TStringList; + fRange: TRangeState; + fLine: PChar; + fLineNumber: integer; + fProcTable: array[#0..#255] of TProcTableProc; + Run: longint; + fStringLen: integer; + fToIdent: PChar; + fTokenPos: integer; + FTokenID: TtkTokenKind; + fCommentAttri: TSynHighLighterAttributes; + fIdentifierAttri: TSynHighLighterAttributes; + fKeyAttri: TSynHighLighterAttributes; + fNumberAttri: TSynHighLighterAttributes; + fSpaceAttri: TSynHighLighterAttributes; + fStringAttri: TSynHighLighterAttributes; + fSymbolAttri: TSynHighLighterAttributes; + fAttribAttri: TSynHighLighterAttributes; + FIeeeAttri: TSynHighLighterAttributes; + fSBAAttri: TSynHighLighterAttributes; + fDivider:TSynDividerDrawConfigSetting; + procedure CommentProc; + function KeyComp(const aKey: string): boolean; + procedure SetHLWordsList(AValue: TStringList); + procedure SymbolsProc; + procedure BraceCloseProc; + procedure BraceOpenProc; + procedure CRProc; + procedure ColonProc; + procedure EqualProc; + procedure EndTokenProc; + 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 RoundCloseProc; + procedure RoundOpenProc; + procedure SemiColonProc; + procedure SlashProc; + procedure SpaceProc; + procedure SquareCloseProc; + procedure SquareOpenProc; + procedure StarProc; + procedure StringProc; + procedure TildeProc; + procedure AttribProc; + procedure XOrSymbolProc; + procedure UnknownProc; + procedure FoldValidProc; + procedure MakeMethodTables; + protected + function GetIdentChars: TSynIdentChars; override; + function GetSampleSource: string; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: integer): TSynHighLighterAttributes; + override; + function GetEOL: boolean; override; + function GetTokenID: TtkTokenKind; + procedure SetLine(const NewValue: String; LineNumber:Integer); override; + function GetToken: string; override; + procedure GetTokenEx(out TokenStart: PChar; out TokenLength: integer); override; + function GetTokenAttribute: TSynHighLighterAttributes; override; + function GetTokenKind: integer; override; + function GetTokenPos: integer; override; + procedure Next; override; + function GetRange: Pointer; override; + procedure SetRange(Value: Pointer); override; + procedure ReSetRange; override; + function GetDrawDivider(Index: integer): TSynDividerDrawConfigSetting; override; + property IdentChars; + class function GetLanguageName: string; 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 AttribAttri: TSynHighLighterAttributes read fAttribAttri write fAttribAttri; + property IeeeAttri: TSynHighLighterAttributes read fIeeeAttri write fIeeeAttri; + property SBAAttri: TSynHighLighterAttributes read fSBAAttri write fSBAAttri; + property HLWordsList: TStringList read FHLWordsList write SetHLWordsList; + end; + +implementation + +var + Identifiers: array[#0..#255] of bytebool; + mHashTable: array[#0..#255] of integer; + +procedure MakeIdentTable; +var + I, J: char; +begin + for I := #0 to #255 do + begin + case I of + '_', '0'..'9', 'a'..'z', 'A'..'Z': Identifiers[I] := True; + else + Identifiers[I] := False; + end; + J := I; //UpCase(I); In verilog the keywords are in lower case + case I in ['_', '0'..'9', 'A'..'Z', 'a'..'z'] of + True: mHashTable[I] := Ord(J) + else + mHashTable[I] := 0; + end; + end; +end; + +function TSynVerilogSyn.KeyComp(const aKey: string): boolean; +var + I: integer; + Temp: PChar; +begin + Temp := fToIdent; // Test from the second char +1 + if Length(aKey) = fStringLen then + begin + Result := True; + for i := 1 to fStringLen do // Test from the second char := 2 + begin + if mHashTable[Temp^] <> mHashTable[aKey[i]] then + begin + Result := False; + break; + end; + inc(Temp); + end; + end + else + Result := False; +end; + +procedure TSynVerilogSyn.SetHLWordsList(AValue: TStringList); +begin + if FHLWordsList=AValue then Exit; + FHLWordsList:=AValue; +end; + +procedure TSynVerilogSyn.IdentProc; +var i:integer; +begin + while Identifiers[fLine[Run]] do inc(Run); + fStringLen:=Run-fTokenPos; + fToIdent:=fLine + fTokenPos; + fTokenID := tkUnknown; + if FHLWordsList.Count>0 then for i:=0 to FHLWordsList.Count-1 do + begin + if KeyComp(FHLWordsList[i]) then fTokenID := tkString; + end; + case Upcase(fToIdent^) of + 'A':begin + //verilog + if KeyComp('always') or + KeyComp('and') or + KeyComp('assign') or + KeyComp('automatic') + then fTokenID := tkKey; + end; + 'B':begin + //verilog + if KeyComp('begin') or + KeyComp('buf') or + KeyComp('bufif0') or + KeyComp('bufif1') + then fTokenID := tkKey; + if KeyComp('begin') then begin fTokenID := tkKey; StartCodeFoldBlock(nil); end; + end; + 'C':begin + //verilog + if KeyComp('cell') or + KeyComp('cmos') or + KeyComp('config') + then fTokenID := tkKey; + if KeyComp('case') then begin fTokenID := tkKey; StartCodeFoldBlock(nil); end; + if KeyComp('casex') then begin fTokenID := tkKey; StartCodeFoldBlock(nil); end; + if KeyComp('casez') then begin fTokenID := tkKey; StartCodeFoldBlock(nil); end; + end; + 'D':begin + //verilog + if KeyComp('deassign') or + KeyComp('default') or + KeyComp('defparam') or + KeyComp('design') or + KeyComp('disable') then fTokenID := tkKey; + end; + 'E':begin + //verilog + if KeyComp('edge') or + KeyComp('else') or + KeyComp('event') + then fTokenID := tkKey; + if KeyComp('end') then endTokenProc; + if KeyComp('endcase') then endTokenProc; + if KeyComp('endconfig') then endTokenProc; + if KeyComp('endfunction') then endTokenProc; + if KeyComp('endgenerate') then endTokenProc; + if KeyComp('endmodule') then endTokenProc; + if KeyComp('endprimitive') then endTokenProc; + if KeyComp('endspecify') then endTokenProc; + if KeyComp('endtable') then endTokenProc; + if KeyComp('endtask') then endTokenProc; + end; + 'F':begin + //verilog + if KeyComp('for') or + KeyComp('force') or + KeyComp('forever') or + KeyComp('fork') or + KeyComp('function') + then fTokenID := tkKey; + end; + 'G':begin + //verilog + if KeyComp('generate') or + KeyComp('genvar') + then fTokenID := tkKey; + end; + 'H':begin + //verilog + if KeyComp('highz0') or + KeyComp('highz1') + then fTokenID := tkKey; + end; + 'I':begin + //verilog + if KeyComp('if') or + KeyComp('ifnone') or + KeyComp('incdir') or + KeyComp('include') or + KeyComp('initial') or + KeyComp('inout') or + KeyComp('input') or + KeyComp('instance') or + KeyComp('integer') + then fTokenID := tkKey; + end; + 'J':begin + if KeyComp('join') then fTokenID := tkKey; + end; + 'K':begin + + end; + 'L':begin + //verilog + if KeyComp('large') or + KeyComp('liblist') or + KeyComp('library') or + KeyComp('localparam') + then fTokenID := tkKey; + end; + 'M':begin + //verilog + if KeyComp('macromodule') or + KeyComp('medium') + then fTokenID := tkKey; + if KeyComp('module') then begin fTokenID := tkKey; StartCodeFoldBlock(nil); end; + end; + 'N':begin + //verilog + if KeyComp('nand') or + KeyComp('negedge') or + KeyComp('nmos') or + KeyComp('nor') or + KeyComp('noshowcancelled') or + KeyComp('not') or + KeyComp('notif0') or + KeyComp('notif1') + then fTokenID := tkKey; + end; + 'O':begin + //verilog + if KeyComp('or') or + KeyComp('output') + then fTokenID := tkKey; + end; + 'P':begin + //verilog + if KeyComp('parameter') or + KeyComp('pmos') or + KeyComp('posedge') or + KeyComp('primitive') or + KeyComp('pull0') or + KeyComp('pull1') or + KeyComp('pulldown') or + KeyComp('pullup') or + KeyComp('pulsestyle_oneventglitch') or + KeyComp('pulsestyle_ondetectglitch') + then fTokenID := tkKey; + //if KeyComp('process') or + // KeyComp('package') then begin fTokenID := tkKey; StartCodeFoldBlock(nil); end; + //if KeyComp('procedure') then begin fTokenID := tkKey; FoldValidProc; end; + end; + 'Q':begin + + end; + 'R':begin + //verilog + if KeyComp('remos') or + KeyComp('real') or + KeyComp('realtime') or + KeyComp('reg') or + KeyComp('release') or + KeyComp('repeat') or + KeyComp('rnmos') or + KeyComp('rpmos') or + KeyComp('rtran') or + KeyComp('rtranif0') or + KeyComp('rtranif1') + then fTokenID := tkKey; + end; + 'S':begin + //verilog + if KeyComp('scalared') or + KeyComp('showcancelled') or + KeyComp('signed') or + KeyComp('small') or + KeyComp('specify') or + KeyComp('specparam') or + KeyComp('strong0') or + KeyComp('strong1') or + KeyComp('supply0') or + KeyComp('supply1') + then fTokenID := tkKey; + //SBA + if KeyComp('sbaread') or + KeyComp('sbawrite') or + KeyComp('sba_config') or + KeyComp('sba_package') or + KeyComp('sba_typedef') or + KeyComp('sbacall') or + KeyComp('sbaret') or + KeyComp('sbajmp') + then fTokenID := tkSBA; + end; + 'T':begin + //verilog + if KeyComp('table') or + KeyComp('task') or + KeyComp('time') or + KeyComp('tran') or + KeyComp('tranif0') or + KeyComp('tranif1') or + KeyComp('tri') or + KeyComp('tri0') or + KeyComp('tri1') or + KeyComp('triand') or + KeyComp('trior') or + KeyComp('trireg') + then fTokenID := tkKey; + end; + 'U':begin + //verilog + if KeyComp('unsigned') or + KeyComp('use') + then fTokenID := tkKey; + end; + 'V':begin + //verilog + if KeyComp('vectored') then fTokenID := tkKey; + end; + 'W':begin + //verilog + if KeyComp('wait') or + KeyComp('wand') or + KeyComp('weak0') or + KeyComp('weak1') or + KeyComp('while') or + KeyComp('wire') or + KeyComp('wor') + then fTokenID := tkKey; +// if KeyComp('while') then begin fTokenID := tkKey; StartCodeFoldBlock(nil); end; + end; + 'X':begin + //verilog + if KeyComp('xnor') or + KeyComp('xor') + then fTokenID := tkKey; + end; + 'Y':begin + + end; + end; +end; + +procedure TSynVerilogSyn.MakeMethodTables; +var + I: char; +begin + for I := #0 to #255 do + case I of + #0 : fProcTable[I] := @NullProc; + '#','$','&','@' : fProcTable[I] := @SymbolsProc; + '}': fProcTable[I] := @BraceCloseProc; + '{': fProcTable[I] := @BraceOpenProc; + #13: fProcTable[I] := @CRProc; + ':': fProcTable[I] := @ColonProc; + '=': fProcTable[I] := @EqualProc; + '>': fProcTable[I] := @GreaterProc; + 'A'..'Z', 'a'..'z', '_': fProcTable[I] := @IdentProc; + #10: fProcTable[I] := @LFProc; + '<': fProcTable[I] := @LowerProc; + '-': fProcTable[I] := @MinusProc; + '%': fProcTable[I] := @ModSymbolProc; + '!': fProcTable[I] := @NotSymbolProc; + '0'..'9': fProcTable[I] := @NumberProc; + '|': fProcTable[I] := @OrSymbolProc; + '+': fProcTable[I] := @PlusProc; + '.': fProcTable[I] := @PointProc; + ')': fProcTable[I] := @RoundCloseProc; + '(': fProcTable[I] := @RoundOpenProc; + ';': fProcTable[I] := @SemiColonProc; + '/': fProcTable[I] := @SlashProc; + #1..#9, #11, #12, #14..#32: fProcTable[I] := @SpaceProc; + ']': fProcTable[I] := @SquareCloseProc; + '[': fProcTable[I] := @SquareOpenProc; + '*': fProcTable[I] := @StarProc; + #34: fProcTable[I] := @StringProc; //" + '~': fProcTable[I] := @TildeProc; + #39: fProcTable[I] := @AttribProc; //' + #96: fProcTable[I] := @AttribProc; //` + '^': fProcTable[I] := @XOrSymbolProc; + else + fProcTable[I] := @UnknownProc; + end; +end; + +constructor TSynVerilogSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment); + fCommentAttri.Foreground := clGreen; + AddAttribute(fCommentAttri); + + fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier); + fIdentifierAttri.Foreground := clWindowText; + AddAttribute(fIdentifierAttri); + + fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord); + fKeyAttri.Foreground := clBlue; + AddAttribute(fKeyAttri); + + fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber); + fNumberAttri.Foreground := clRed; + AddAttribute(fNumberAttri); + + fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrWhitespace); + AddAttribute(fSpaceAttri); + + fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString); + fStringAttri.Foreground := clMaroon; + AddAttribute(fStringAttri); + + fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol); + fSymbolAttri.Foreground := clTeal; + AddAttribute(fSymbolAttri); + + fAttribAttri := TSynHighLighterAttributes.Create(SYNS_AttrAttributeName); + fAttribAttri.Foreground := $000080FF; + AddAttribute(fAttribAttri); + + fIeeeAttri := TSynHighLighterAttributes.Create(SYNS_AttrSecondReservedWord); + fIeeeAttri.Foreground := $00804000; + AddAttribute(fIeeeAttri); + + fSBAAttri := TSynHighLighterAttributes.Create(SYNS_AttrMiscellaneous); + fSBAAttri.Foreground := $00C08000; + AddAttribute(fSBAAttri); + + SetAttributesOnChange(@DefHighlightChange); + MakeMethodTables; + fRange := rsUnknown; + fDefaultFilter := SYNS_FilterVerilog; + + fDivider.Color:=clNone; + FHLWordsList:=TStringList.Create; +end; + +destructor TSynVerilogSyn.Destroy; +begin + FreeAndNil(FHLWordsList); + inherited Destroy; +end; + +procedure TSynVerilogSyn.SetLine(const NewValue: String; LineNumber: Integer); +begin + inherited; + fLine := PChar(NewValue); + Run := 0; + fLineNumber := LineNumber; + Next; +end; + +procedure TSynVerilogSyn.SymbolsProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVerilogSyn.BraceCloseProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVerilogSyn.BraceOpenProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVerilogSyn.CRProc; +begin + fTokenID := tkSpace; + Inc(Run); + if fLine[Run + 1] = #10 then Inc(Run); +end; + +procedure TSynVerilogSyn.ColonProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.EqualProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.GreaterProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.LFProc; +begin + fTokenID := tkSpace; + inc(Run); +end; + +procedure TSynVerilogSyn.LowerProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.MinusProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.SlashProc; +begin + fTokenID := tkSymbol; + inc(Run); + + if (FLine[Run] = '/') then + begin + if (FLine[Run+1] = ' ') and (FLine[Run+2] = '/') and + (FLine[Run+3] = 'L') and (FLine[Run+4] = ':') then + begin + fTokenID := tkSBA; + end else fTokenID := tkComment; + while not (FLine[Run] in [#0, #10, #13]) do inc(Run); + end else if (FLine[Run] = '*') then + begin + fRange := rsComment; //marca inicio de rango comentario + CommentProc; //Procesa en modo rango comentario + end; +end; + +procedure TSynVerilogSyn.CommentProc; +begin + fTokenID := tkComment; + if (FLine[Run]=#0) then begin NullProc; exit; end; // Si fin de lĂ­nea + while not (FLine[Run] in [#0, #10, #13]) do + begin + if (FLine[Run]='*') and (FLine[Run+1]='/') then + begin + fRange:=rsUnknown; + inc(Run,2); + break; + end else inc(Run); + end; +end; + +procedure TSynVerilogSyn.ModSymbolProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVerilogSyn.NotSymbolProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.NullProc; +begin + fTokenID := tkNull; +end; + +procedure TSynVerilogSyn.NumberProc; +begin + fTokenID := tkNumber; + while FLine[Run] in ['0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F'] do + inc(Run); +end; + +procedure TSynVerilogSyn.OrSymbolProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVerilogSyn.PlusProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.PointProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.RoundCloseProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.RoundOpenProc; +begin + inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.SemiColonProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.SpaceProc; +begin + inc(Run); + fTokenID := tkSpace; + while FLine[Run] in [#1..#9, #11, #12, #14..#32] do inc(Run); +end; + +procedure TSynVerilogSyn.SquareCloseProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.SquareOpenProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.StarProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVerilogSyn.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 TSynVerilogSyn.TildeProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVerilogSyn.AttribProc; +var + tmp:integer; + c:char; + +begin + fTokenID := tkSymbol; + inc(Run); + tmp:=Run; + c:=lowercase(fLine[Run]); + while fLine[tmp] in ['a'..'z','A'..'Z'] do inc(tmp); + fStringLen:=tmp-fTokenPos; + fToIdent:=fLine + fTokenPos; + if (c='b') or + (c='d') or + (c='h') or + keycomp('''include') or + keycomp('''ifdef') or + keycomp('''ifndef') or + keycomp('''define') or + keycomp('''endif') or + keycomp('''else') or + (c='o') then + begin + fTokenID := tkAttribute; + while fLine[Run] in ['a'..'z','A'..'Z'] do inc(Run); + end; +end; + +procedure TSynVerilogSyn.XOrSymbolProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVerilogSyn.EndTokenProc; +//var tmp:integer; +begin + fTokenID := tkKey; + //while fLine[Run]=' ' do inc(Run); + //tmp:=Run; + //while Identifiers[fLine[Run]] do inc(Run); + //fStringLen:=Run-tmp; + //fToIdent:=fLine + tmp; + //if not ( + // keycomp('architecture') or + // keycomp('if') or + // keycomp('case') or + // keycomp('component') or + // keycomp('function') or + // keycomp('loop') or + // keycomp('package') or + // keycomp('procedure') or + // keycomp('process') + // ) then Run:=tmp; + EndCodeFoldBlock(); +end; + +procedure TSynVerilogSyn.UnknownProc; +begin + inc(Run); + while (fLine[Run] in [#128..#191]) OR // continued utf8 subcode + ((fLine[Run]<>#0) and (fProcTable[fLine[Run]] = @UnknownProc)) do inc(Run); + fTokenID := tkUnknown; +end; + +procedure TSynVerilogSyn.FoldValidProc; +var + tmp:integer; + found:boolean; +begin + tmp:=run; + found:=false; + while (not (fLine[tmp] in [#0, #10, #13])) do if fLine[tmp]=';' then + begin + found:=true; + break; + end else inc(tmp); + if not found then StartCodeFoldBlock(nil); +end; + +procedure TSynVerilogSyn.Next; +begin + fTokenPos := Run; + if fRange = rsComment then CommentProc else fProcTable[fLine[Run]]; +end; + +function TSynVerilogSyn.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 TSynVerilogSyn.GetEOL: boolean; +begin + Result := fTokenID = tkNull; +end; + +function TSynVerilogSyn.GetToken: string; +var + Len: longint; +begin + Len := Run - fTokenPos; + SetString(Result, (FLine + fTokenPos), Len); +end; + +procedure TSynVerilogSyn.GetTokenEx(out TokenStart: PChar; out TokenLength: integer); +begin + TokenLength:=Run-fTokenPos; + TokenStart := fLine + fTokenPos; + + //if TokenLength>0 then begin + // TokenStart:=@fLine[fTokenPos]; + //end else begin + // TokenStart:=nil; + //end; +end; + +function TSynVerilogSyn.GetTokenID: TtkTokenKind; +begin + Result := fTokenId; +end; + +function TSynVerilogSyn.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; + tkAttribute: Result := fAttribAttri; + tkIeee: Result := fIeeeAttri; + tkSBA: Result := fSBAAttri; + tkUnknown: Result := fIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynVerilogSyn.GetTokenKind: integer; +begin + Result := Ord(fTokenId); +end; + +function TSynVerilogSyn.GetTokenPos: integer; +begin + Result := fTokenPos; +end; + +function TSynVerilogSyn.GetRange: Pointer; +begin +// Result := Pointer(fRange); + CodeFoldRange.RangeType := Pointer(PtrInt(fRange)); + Result := inherited; +end; + +procedure TSynVerilogSyn.ReSetRange; +begin + inherited; + fRange := rsUnknown; +end; + +function TSynVerilogSyn.GetDrawDivider(Index: integer + ): TSynDividerDrawConfigSetting; +begin + Result:=fDivider; +end; + +procedure TSynVerilogSyn.SetRange(Value: Pointer); +begin + // fRange := TRangeState(Value); + inherited; + fRange := TRangeState(PtrUInt(CodeFoldRange.RangeType)); +end; + +function TSynVerilogSyn.GetIdentChars: TSynIdentChars; +begin + Result := ['_', '0'..'9', 'a'..'z', 'A'..'Z']; +end; + +class function TSynVerilogSyn.GetLanguageName :string; +begin + Result := SYNS_LangVerilog; +end; + +function TSynVerilogSyn.GetSampleSource: string; +begin + Result := + '// ----------------------------------------------------------'+LineEnding+ + '// Module: verilogtest_2'+LineEnding+ + '// ----------------------------------------------------------'+LineEnding+ + ''+LineEnding+ + '`timescale 1ns / 100ps'+LineEnding+ + ''+LineEnding+ + 'module nc_test_2(Y, A, B, sel);'+LineEnding+ + ' output [15:0] Y;'+LineEnding+ + ' input [15:0] A, B;'+LineEnding+ + ' input sel;'+LineEnding+ + ' reg [15:0] Y;'+LineEnding+ + ' always @(A or B or sel)'+LineEnding+ + ' if (sel == 1''b0)'+LineEnding+ + ' Y = A;'+LineEnding+ + ' else'+LineEnding+ + ' Y = B;'+LineEnding+ + 'endmodule '; +end; + +initialization + MakeIdentTable; + RegisterPlaceableHighlighter(TSynVerilogSyn); + +end. + diff --git a/components/extrasyn/SyneditHighlighters/synhighlightervhdl.pas b/components/extrasyn/SyneditHighlighters/synhighlightervhdl.pas new file mode 100644 index 000000000..d1a5b0502 --- /dev/null +++ b/components/extrasyn/SyneditHighlighters/synhighlightervhdl.pas @@ -0,0 +1,1120 @@ +{------------------------------------------------------------------------------- +SynHighlighterVHDL v1.3 + +This unit provides a SBA VHDL highlighter for SynEdit. + +2018 (c) Miguel A. Risco-Castillo + +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. + +Some concepts in this unit are based in the Original Code of Zhou Kan and +"La Biblia del SynEdit" of Tito Hinostroza. +All Rights Reserved. + +v1.3 2019/12/21 +Adapted to extrasyn package + +v1.2 2018/04/25 +Add SBAsector Attribute for highlight sections of SBA code + +v1.1 +Add special list of highlighted words +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNHIGHLIGHTERVHDL} +unit SynHighlighterVHDL; +{$ENDIF} + +// extrasyn.inc is the synedit.inc from laz 1.2.0 synedit package source, +// If it has changed in newer version you might need to copy it again. +// Remember to redclare the syn_lazarus define. +{$I extrasyn.inc} +{$H+} + +interface + +uses + SysUtils, Classes, Graphics, SynEditStrConstExtra, SynEditHighlighterFoldBase, SynEditHighlighter, SynEditTypes, SynEditStrConst; + +type + TtkTokenKind = (tkSBA, tkSBAsector, tkIeee, tkComment, tkIdentifier, tkKey, tkNull, + tkNumber, tkSpace, tkString, tkSymbol, tkAttribute, tkUnknown); + + TRangeState = (rsUnknown); + + TProcTableProc = procedure of object; + + TBlockID = ( + PackageBlk, // Package block + EntityBlk, + ArchBlk, // Declarative + ArchImplBlk, // Implementation + CompBlk, + EntCompBlk, + MapBlk, + RecordBlk, + ProcessBlk, + CaseBlk, + ForBlk, + IfBlk, + WhileBlk, + FuncProcBlk + ); + +type + + { TSynVHDLSyn } + + TSynVHDLSyn = class(TSynCustomFoldHighlighter) + private + FHLWordsList: TStringList; + fRange: TRangeState; + fLine: PChar; + fLineNumber: integer; + fProcTable: array[#0..#255] of TProcTableProc; + Run: longint; + fStringLen: integer; + fToIdent: PChar; + fTokenPos: integer; + FTokenID: TtkTokenKind; + fCommentAttri: TSynHighLighterAttributes; + fIdentifierAttri: TSynHighLighterAttributes; + fKeyAttri: TSynHighLighterAttributes; + fNumberAttri: TSynHighLighterAttributes; + fSpaceAttri: TSynHighLighterAttributes; + fStringAttri: TSynHighLighterAttributes; + fSymbolAttri: TSynHighLighterAttributes; + fAttribAttri: TSynHighLighterAttributes; + FIeeeAttri: TSynHighLighterAttributes; + fSBAAttri: TSynHighLighterAttributes; + fSBAsectorAttri: TSynHighLighterAttributes; + fDivider:TSynDividerDrawConfigSetting; + function KeyComp(const aKey: string): boolean; + procedure SetHLWordsList(AValue: TStringList); + procedure SymbolsProc; + procedure BraceCloseProc; + procedure BraceOpenProc; + procedure CRProc; + procedure ColonProc; + procedure EqualProc; + procedure EndTokenProc; + 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 RoundCloseProc; + procedure RoundOpenProc; + procedure SemiColonProc; + procedure SlashProc; + procedure SpaceProc; + procedure SquareCloseProc; + procedure SquareOpenProc; + procedure StarProc; + procedure StringProc; + procedure TildeProc; + procedure AttribProc; + procedure XOrSymbolProc; + procedure UnknownProc; + procedure FoldValidProc; + procedure MakeMethodTables; + protected + function GetSampleSource: string; override; + function GetIdentChars: TSynIdentChars; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: integer): TSynHighLighterAttributes; + override; + function GetEOL: boolean; override; + function GetTokenID: TtkTokenKind; + procedure SetLine(const NewValue: String; LineNumber:Integer); override; + function GetToken: string; override; + procedure GetTokenEx(out TokenStart: PChar; out TokenLength: integer); override; + function GetTokenAttribute: TSynHighLighterAttributes; override; + function GetTokenKind: integer; override; + function GetTokenPos: integer; override; + procedure Next; override; + function GetRange: Pointer; override; + procedure SetRange(Value: Pointer); override; + procedure ReSetRange; override; + function GetDrawDivider(Index: integer): TSynDividerDrawConfigSetting; override; + property IdentChars; + class function GetLanguageName: string; 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 AttribAttri: TSynHighLighterAttributes read fAttribAttri write fAttribAttri; + property IeeeAttri: TSynHighLighterAttributes read fIeeeAttri write fIeeeAttri; + property SBAAttri: TSynHighLighterAttributes read fSBAAttri write fSBAAttri; + property SBAsectorAttrib:TSynHighlighterAttributes read fSBAsectorAttri write fSBAsectorAttri; + property HLWordsList: TStringList read FHLWordsList write SetHLWordsList; + end; + +implementation + +var + Identifiers: array[#0..#255] of bytebool; + mHashTable: array[#0..#255] of integer; + +procedure MakeIdentTable; +var + I, J: char; +begin + for I := #0 to #255 do + begin + case I of + '_', '0'..'9', 'a'..'z', 'A'..'Z': Identifiers[I] := True; + else + Identifiers[I] := False; + end; + J := UpCase(I); + case I in ['_', '0'..'9', 'A'..'Z', 'a'..'z'] of + True: mHashTable[I] := Ord(J) + else + mHashTable[I] := 0; + end; + end; +end; + +function TSynVHDLSyn.KeyComp(const aKey: string): boolean; +var + I: integer; + Temp: PChar; +begin + Temp := fToIdent; // Test from the second char +1 + if Length(aKey) = fStringLen then + begin + Result := True; + for i := 1 to fStringLen do // Test from the second char := 2 + begin + if mHashTable[Temp^] <> mHashTable[aKey[i]] then + begin + Result := False; + break; + end; + inc(Temp); + end; + end + else + Result := False; +end; + +procedure TSynVHDLSyn.SetHLWordsList(AValue: TStringList); +begin + if FHLWordsList=AValue then Exit; + if assigned(FHLWordsList) then FHLWordsList.Free; + FHLWordsList:=AValue; +end; + +procedure TSynVHDLSyn.IdentProc; +var + i:integer; + blk:TBlockID; +begin + while Identifiers[fLine[Run]] do inc(Run); + fStringLen:=Run-fTokenPos; + fToIdent:=fLine + fTokenPos; + fTokenID := tkUnknown; + if FHLWordsList.Count>0 then for i:=0 to FHLWordsList.Count-1 do + begin + if KeyComp(FHLWordsList[i]) then fTokenID := tkString; + end; + blk:=TBlockID(PtrUInt(TopCodeFoldBlockType)); + case Upcase(fToIdent^) of + 'A':begin + //vhdl + if KeyComp('abs') or + KeyComp('access') or + KeyComp('after') or + KeyComp('alias') or + KeyComp('all') or + KeyComp('and') or + KeyComp('array') or + KeyComp('assert') or + KeyComp('attribute') + then fTokenID := tkKey; + if KeyComp('architecture') then begin fTokenID := tkKey; StartCodeFoldBlock(Pointer(PtrUInt(ArchBlk))); end; + //ieee + if KeyComp('add_unsigned') or + KeyComp('and_table') or + KeyComp('append_mode') + then fTokenID := tkIeee; + end; + 'B':begin + //vhdl + if KeyComp('begin') or + KeyComp('block') or + KeyComp('body') or + KeyComp('buffer') or + KeyComp('bus') + then fTokenID := tkKey; +// if KeyComp('begin') then begin fTokenID := tkKey; StartCodeFoldBlock(nil); end; + //ieee + if KeyComp('bit_vector') or + KeyComp('bit') or + KeyComp('bitwise_eql') or + KeyComp('bitwise_neq') or + KeyComp('boolean') + then fTokenID := tkIeee; + end; + 'C':begin + //vhdl + if KeyComp('configuration') or + KeyComp('constant') + then fTokenID := tkKey; + if KeyComp('case') then begin fTokenID := tkKey; StartCodeFoldBlock(Pointer(PtrUInt(CaseBlk))); end; + if KeyComp('component') then begin + fTokenID := tkKey; + if (Blk=ArchBlk) then StartCodeFoldBlock(Pointer(PtrUInt(CompBlk))); + end; + //ieee + if KeyComp('character') then fTokenID := tkIeee; + end; + 'D':begin + //vhdl + if KeyComp('disconnect') or + KeyComp('downto') then fTokenID := tkKey; + //ieee + if KeyComp('delay_length') then fTokenID := tkieee; + end; + 'E':begin + //vhdl + if KeyComp('else') or + KeyComp('elsif') or + KeyComp('exit') + then fTokenID := tkKey; + if KeyComp('entity') then + begin + fTokenID := tkKey; + if (Blk<>ArchBlk) then StartCodeFoldBlock(Pointer(PtrUInt(EntityBlk))) else StartCodeFoldBlock(Pointer(PtrUInt(EntCompBlk))); + end; + if KeyComp('end') then endTokenProc; + end; + 'F':begin + //vhdl + if KeyComp('file') then fTokenID := tkKey; + if KeyComp('for') then fTokenID := tkKey; + if KeyComp('function')then begin fTokenID := tkKey; FoldValidProc; end; + //ieee + if KeyComp('falling_edge') or + KeyComp('false') or + KeyComp('fs') + then fTokenID := tkIeee; + end; + 'G':begin + //vhdl + if KeyComp('generate') or + KeyComp('generic') or + KeyComp('group') or + KeyComp('guarded') + then fTokenID := tkKey; + end; + 'H':begin + //ieee + if KeyComp('hr') then fTokenID := tkIeee; + end; + 'I':begin + //vhdl + if KeyComp('if') then begin fTokenID := tkKey; StartCodeFoldBlock(Pointer(PtrUInt(IfBlk))); end; + if KeyComp('impure') or + KeyComp('in') or + KeyComp('inertial') or + KeyComp('inout') or + KeyComp('is') + then fTokenID := tkKey; + //ieee + if KeyComp('ieee') or + KeyComp('image') or + KeyComp('input') or + KeyComp('integer') or + KeyComp('is_x') + then fTokenID := tkIeee; + end; + 'J':begin + end; + 'K':begin + end; + 'L':begin + //vhdl + if KeyComp('label') or + KeyComp('library') or + KeyComp('linkage') or + KeyComp('literal') + then fTokenID := tkKey; + if KeyComp('loop') then begin fTokenID := tkKey; StartCodeFoldBlock(Pointer(PtrUInt(ForBlk))); end; + end; + 'M':begin + //vhdl + if KeyComp('map') then begin fTokenID := tkKey; end; //StartCodeFoldBlock(Pointer(PtrUInt(MapBlk))); end; + if KeyComp('mod') then fTokenID := tkKey; + //ieee + if KeyComp('math_real') or + KeyComp('min') or + KeyComp('ms') + then fTokenID := tkIeee; + end; + 'N':begin + //vhdl + if KeyComp('nand') or + KeyComp('new') or + KeyComp('next') or + KeyComp('nor') or + KeyComp('not') or + KeyComp('null') + then fTokenID := tkKey; + //ieee + if KeyComp('natural') or + KeyComp('ns') or + KeyComp('numeric_bit') or + KeyComp('numeric_std') + then fTokenID := tkIeee; + end; + 'O':begin + //vhdl + if KeyComp('of') or + KeyComp('on') or + KeyComp('open') or + KeyComp('or') or + KeyComp('others') or + KeyComp('out') + then fTokenID := tkKey; + //ieee + if KeyComp('output') then fTokenID := tkIeee; + end; + 'P':begin + //vhdl + if KeyComp('port') or + KeyComp('postponed') or + KeyComp('pure') + then fTokenID := tkKey; + if KeyComp('process') or + KeyComp('package') then begin fTokenID := tkKey; StartCodeFoldBlock(Pointer(PtrUInt(PackageBlk))); end; + if KeyComp('procedure') then begin fTokenID := tkKey; FoldValidProc; end; + //ieee + if KeyComp('positive') or + KeyComp('pos') or + KeyComp('ps') + then fTokenID := tkIeee; + end; + 'Q':begin + end; + 'R':begin + //vhdl + if KeyComp('range') or + KeyComp('register') or + KeyComp('reject') or + KeyComp('rem') or + KeyComp('report') or + KeyComp('return') or + KeyComp('rol') or + KeyComp('ror') + then fTokenID := tkKey; + if KeyComp('record') then begin fTokenID := tkKey; StartCodeFoldBlock(Pointer(PtrUInt(RecordBlk))); end; + //ieee + if KeyComp('real') or + KeyComp('resize') or + KeyComp('rising_edge') or + KeyComp('rotate_left') or + KeyComp('rotate_right') + then fTokenID := tkIeee; + end; + 'S':begin + //vhdl + if KeyComp('select') or + KeyComp('severity') or + KeyComp('signal') or + KeyComp('shared') or + KeyComp('sla') or + KeyComp('sll') or + KeyComp('sra') or + KeyComp('srl') or + KeyComp('subtype') + then fTokenID := tkKey; + //ieee + if KeyComp('severity_level') or + KeyComp('sec') or + KeyComp('shift_left') or + KeyComp('shift_right') or + KeyComp('shl') or + KeyComp('shr') or + KeyComp('signed_equal') or + KeyComp('signed_less_or_equal') or + KeyComp('signed_less') or + KeyComp('signed_num_bits') or + KeyComp('signed_return_boolean') or + KeyComp('signed') or + KeyComp('small_int') or + KeyComp('sqrt') or + KeyComp('standard') or + KeyComp('status_error') or + KeyComp('std_logic_1164') or + KeyComp('std_logic_arith') or + KeyComp('std_logic_signed') or + KeyComp('std_logic_unsigned') or + KeyComp('std_logic_vector') or + KeyComp('std_logic') or + KeyComp('std_match') or + KeyComp('std_ulogic_vector') or + KeyComp('std_ulogic') or + KeyComp('string') + then fTokenID := tkIeee; + //SBA + if KeyComp('sbacall') or + KeyComp('sbaconfig') or + KeyComp('sbainte') or + KeyComp('sbajump') or + KeyComp('sbapackage') or + KeyComp('sbaread') or + KeyComp('sbaret') or + KeyComp('sbareti') or + KeyComp('sbawait') or + KeyComp('sbawrite') + then fTokenID := tkSBA; + end; + 'T':begin + //vhdl + if KeyComp('then') or + KeyComp('to') or + KeyComp('transport') or + KeyComp('type') + then fTokenID := tkKey; + //ieee + if KeyComp('text') or + KeyComp('textio') or + KeyComp('time') or + KeyComp('to_01') or + KeyComp('to_bit') or + KeyComp('to_bitvector') or + KeyComp('to_integer') or + KeyComp('to_signed') or + KeyComp('to_stdlogicvector') or + KeyComp('to_stdulogic') or + KeyComp('to_stdulogicvector') or + KeyComp('to_unsigned') or + KeyComp('true') + then fTokenID := tkIeee; + end; + 'U':begin + //vhdl + if KeyComp('unaffected') or + KeyComp('units') or + KeyComp('until') or + KeyComp('use') + then fTokenID := tkKey; + //ieee + if KeyComp('unsigned') or + KeyComp('us') + then fTokenID := tkIeee; + end; + 'V':begin + //vhdl + if KeyComp('variable') then fTokenID := tkKey; + //ieee + if KeyComp('val') then fTokenID := tkIeee; + end; + 'W':begin + //vhdl + if KeyComp('wait') or + KeyComp('when') or + KeyComp('with') + then fTokenID := tkKey; + if KeyComp('while') then begin fTokenID := tkKey; StartCodeFoldBlock(Pointer(PtrUInt(WhileBlk))); end; + //ieee + if KeyComp('work') then fTokenID := tkIeee; + end; + 'X':begin + //vhdl + if KeyComp('xnor') or + KeyComp('xor') + then fTokenID := tkKey; + //ieee + if KeyComp('xrol') or + KeyComp('xror') or + KeyComp('xsll') or + KeyComp('xsra') or + KeyComp('xsrl') + then fTokenID := tkIeee; + end; + 'Y':begin + end; + 'Z':begin + end; + end; +end; + +procedure TSynVHDLSyn.MakeMethodTables; +var + I: char; +begin + for I := #0 to #255 do + case I of + #0 : fProcTable[I] := @NullProc; + '#','$','&','@' : fProcTable[I] := @SymbolsProc; + '}': fProcTable[I] := @BraceCloseProc; + '{': fProcTable[I] := @BraceOpenProc; + #13: fProcTable[I] := @CRProc; + ':': fProcTable[I] := @ColonProc; + '=': fProcTable[I] := @EqualProc; + '>': fProcTable[I] := @GreaterProc; + 'A'..'Z', 'a'..'z', '_': fProcTable[I] := @IdentProc; + #10: fProcTable[I] := @LFProc; + '<': fProcTable[I] := @LowerProc; + '-': fProcTable[I] := @MinusProc; + '%': fProcTable[I] := @ModSymbolProc; + '!': fProcTable[I] := @NotSymbolProc; + '0'..'9': fProcTable[I] := @NumberProc; + '|': fProcTable[I] := @OrSymbolProc; + '+': fProcTable[I] := @PlusProc; + '.': fProcTable[I] := @PointProc; + '(': fProcTable[I] := @RoundOpenProc; + ')': fProcTable[I] := @RoundCloseProc; + ';': fProcTable[I] := @SemiColonProc; + '/': fProcTable[I] := @SlashProc; + #1..#9, #11, #12, #14..#32: fProcTable[I] := @SpaceProc; + ']': fProcTable[I] := @SquareCloseProc; + '[': fProcTable[I] := @SquareOpenProc; + '*': fProcTable[I] := @StarProc; + #34: fProcTable[I] := @StringProc; //" + '~': fProcTable[I] := @TildeProc; + #39: fProcTable[I] := @AttribProc; //' + '^': fProcTable[I] := @XOrSymbolProc; + else + fProcTable[I] := @UnknownProc; + end; +end; + +constructor TSynVHDLSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment); + fCommentAttri.Foreground := clGreen; + AddAttribute(fCommentAttri); + + fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier); + fIdentifierAttri.Foreground := clWindowText; + AddAttribute(fIdentifierAttri); + + fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord); + fKeyAttri.Foreground := clBlue; + AddAttribute(fKeyAttri); + + fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber); + fNumberAttri.Foreground := clRed; + AddAttribute(fNumberAttri); + + fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrWhitespace); + AddAttribute(fSpaceAttri); + + fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString); + fStringAttri.Foreground := clMaroon; + AddAttribute(fStringAttri); + + fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol); + fSymbolAttri.Foreground := clTeal; + AddAttribute(fSymbolAttri); + + fAttribAttri := TSynHighLighterAttributes.Create(SYNS_AttrAttributeName); + fAttribAttri.Foreground := $000080FF; + AddAttribute(fAttribAttri); + + fIeeeAttri := TSynHighLighterAttributes.Create(SYNS_AttrSecondReservedWord); + fIeeeAttri.Foreground := $00804000; + AddAttribute(fIeeeAttri); + + fSBAAttri := TSynHighLighterAttributes.Create(SYNS_AttrMiscellaneous); + fSBAAttri.Foreground := $00C08000; + AddAttribute(fSBAAttri); + + fSBAsectorAttri := TSynHighLighterAttributes.Create(SYNS_AttrLabel); + fSBAsectorAttri.Foreground := $00C08000; + fSBAsectorAttri.Style:=[fsBold]; + AddAttribute(fSBAsectorAttri); + + SetAttributesOnChange(@DefHighlightChange); + MakeMethodTables; + fRange := rsUnknown; + fDefaultFilter := SYNS_FilterVHDL; + + fDivider.Color:=clNone; + + FHLWordsList:=TStringList.Create; +end; + +destructor TSynVHDLSyn.Destroy; +begin + FreeAndNil(FHLWordsList); + inherited Destroy; +end; + +procedure TSynVHDLSyn.SetLine(const NewValue: String; LineNumber: Integer); +begin + inherited; + fLine := PChar(NewValue); + Run := 0; + fLineNumber := LineNumber; + Next; +end; + +procedure TSynVHDLSyn.SymbolsProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVHDLSyn.BraceCloseProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVHDLSyn.BraceOpenProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVHDLSyn.CRProc; +begin + fTokenID := tkSpace; + Inc(Run); + if fLine[Run + 1] = #10 then Inc(Run); +end; + +procedure TSynVHDLSyn.ColonProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.EqualProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.GreaterProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.LFProc; +begin + fTokenID := tkSpace; + inc(Run); +end; + +procedure TSynVHDLSyn.LowerProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.MinusProc; +begin + fTokenID := tkSymbol; + inc(Run); + + if (FLine[Run] = '-') then + begin + if (FLine[Run+1] = ' ') and (FLine[Run+2] = '/') and + (((FLine[Run+3] = 'L') and (FLine[Run+4] = ':')) or + ((FLine[Run+3] = 'S') and (FLine[Run+4] = 'B') and (FLine[Run+5] = 'A') and (FLine[Run+6] = ':'))) + then + begin + fTokenID := tkSBASector; + end else fTokenID := tkComment; + while not (FLine[Run] in [#0, #10, #13]) do inc(Run); + end; +end; + +procedure TSynVHDLSyn.ModSymbolProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVHDLSyn.NotSymbolProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.NullProc; +begin + fTokenID := tkNull; +end; + +procedure TSynVHDLSyn.NumberProc; +begin + fTokenID := tkNumber; + while FLine[Run] in ['0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F'] do + inc(Run); +end; + +procedure TSynVHDLSyn.OrSymbolProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVHDLSyn.PlusProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.PointProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.RoundCloseProc; +var Blk:TBlockID; +begin + blk:=TBlockID(PtrUInt(TopCodeFoldBlockType)); + if blk=MapBlk then EndCodeFoldBlock(); + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.RoundOpenProc; +begin + inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.SemiColonProc; +var Blk:TBlockID; +begin + blk:=TBlockID(PtrUInt(TopCodeFoldBlockType)); + if blk=EntCompBlk then EndCodeFoldBlock(); + inc(Run); + fTokenID := tkSymbol; +end; + + +procedure TSynVHDLSyn.SlashProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.SpaceProc; +begin + inc(Run); + fTokenID := tkSpace; + while FLine[Run] in [#1..#9, #11, #12, #14..#32] do inc(Run); +end; + +procedure TSynVHDLSyn.SquareCloseProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.SquareOpenProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.StarProc; +begin + inc(Run); + fTokenID := tkSymbol; +end; + +procedure TSynVHDLSyn.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 TSynVHDLSyn.TildeProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVHDLSyn.AttribProc; +var tmp:integer; +begin + fTokenID := tkSymbol; + inc(Run); + tmp:=Run; + while Identifiers[fLine[tmp]] do inc(tmp); + fStringLen:=tmp-fTokenPos; + fToIdent:=fLine + fTokenPos; + + if keycomp('''ascending') or + keycomp('''base') or + keycomp('''delayed') or + keycomp('''driving') or + keycomp('''driving_value') or + keycomp('''event') or + keycomp('''high') or + keycomp('''image') or + keycomp('''instance_name') or + keycomp('''last_active') or + keycomp('''last_event') or + keycomp('''last_value') or + keycomp('''left') or + keycomp('''leftof') or + keycomp('''length') or + keycomp('''low') or + keycomp('''path_name') or + keycomp('''pos') or + keycomp('''pred') or + keycomp('''quiet') or + keycomp('''range') or + keycomp('''reverse_range') or + keycomp('''right') or + keycomp('''rightof') or + keycomp('''simple_name') or + keycomp('''stable') or + keycomp('''succ') or + keycomp('''transaction') or + keycomp('''val') or + keycomp('''value') then + begin + fTokenID := tkAttribute; + while Identifiers[fLine[Run]] do inc(Run); + end; +end; + +procedure TSynVHDLSyn.XOrSymbolProc; +begin + inc(Run); + fTokenId := tkSymbol; +end; + +procedure TSynVHDLSyn.EndTokenProc; +var tmp:integer; +begin + fTokenID := tkKey; + while fLine[Run]=' ' do inc(Run); + tmp:=Run; + while Identifiers[fLine[Run]] do inc(Run); + fStringLen:=Run-tmp; + fToIdent:=fLine + tmp; + if not ( + keycomp('architecture') or + keycomp('if') or + keycomp('case') or + keycomp('component') or + keycomp('function') or + keycomp('loop') or + keycomp('package') or + keycomp('procedure') or + keycomp('process') or + keycomp('record') + ) then Run:=tmp; + EndCodeFoldBlock(); +end; + +procedure TSynVHDLSyn.UnknownProc; +begin + inc(Run); + while (fLine[Run] in [#128..#191]) OR // continued utf8 subcode + ((fLine[Run]<>#0) and (fProcTable[fLine[Run]] = @UnknownProc)) do inc(Run); + fTokenID := tkUnknown; +end; + +procedure TSynVHDLSyn.FoldValidProc; +var + tmp:integer; + found:boolean; + inRoundbracket:boolean=false; +begin + tmp:=run; + found:=false; + while (not (fLine[tmp] in [#0, #10, #13])) do + begin + if (fLine[tmp]='(') then inRoundbracket:=true; + if (fLine[tmp]=')') then inRoundbracket:=false; + if (fLine[tmp]=';') and not inRoundbracket then + begin + found:=true; + break; + end else inc(tmp); + end; + if not found then StartCodeFoldBlock(Pointer(PtrUInt(FuncProcBlk))); +end; + +procedure TSynVHDLSyn.Next; +begin + fTokenPos := Run; + fProcTable[fLine[Run]]; +end; + +function TSynVHDLSyn.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 TSynVHDLSyn.GetEOL: boolean; +begin + Result := fTokenID = tkNull; +end; + +function TSynVHDLSyn.GetToken: string; +var + Len: longint; +begin + Len := Run - fTokenPos; + SetString(Result, (FLine + fTokenPos), Len); +end; + +procedure TSynVHDLSyn.GetTokenEx(out TokenStart: PChar; out TokenLength: integer); +begin + TokenLength:=Run-fTokenPos; + TokenStart := fLine + fTokenPos; + + //if TokenLength>0 then begin + // TokenStart:=@fLine[fTokenPos]; + //end else begin + // TokenStart:=nil; + //end; +end; + +function TSynVHDLSyn.GetTokenID: TtkTokenKind; +begin + Result := fTokenId; +end; + +function TSynVHDLSyn.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; + tkAttribute: Result := fAttribAttri; + tkIeee: Result := fIeeeAttri; + tkSBA: Result := fSBAAttri; + tkSBAsector: Result := fSBAsectorAttri; + tkUnknown: Result := fIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynVHDLSyn.GetTokenKind: integer; +begin + Result := Ord(fTokenId); +end; + +function TSynVHDLSyn.GetTokenPos: integer; +begin + Result := fTokenPos; +end; + +function TSynVHDLSyn.GetRange: Pointer; +begin +// Result := Pointer(fRange); + CodeFoldRange.RangeType := Pointer(PtrInt(fRange)); + Result := inherited; +end; + +procedure TSynVHDLSyn.ReSetRange; +begin + inherited; + fRange := rsUnknown; +end; + +function TSynVHDLSyn.GetDrawDivider(Index: integer + ): TSynDividerDrawConfigSetting; +begin + Result:=fDivider; +end; + +procedure TSynVHDLSyn.SetRange(Value: Pointer); +begin + // fRange := TRangeState(Value); + inherited; + fRange := TRangeState(PtrUInt(CodeFoldRange.RangeType)); +end; + +function TSynVHDLSyn.GetIdentChars: TSynIdentChars; +begin + Result := ['_', '0'..'9', 'a'..'z', 'A'..'Z']; +end; + +class function TSynVHDLSyn.GetLanguageName :string; +begin + Result := SYNS_LangVHDL; +end; + +function TSynVHDLSyn.GetSampleSource: string; +begin + Result := + 'entity DEMO is'+LineEnding+ + 'generic('+LineEnding+ + ' debug:positive:=1;'+LineEnding+ + ' sysfreq:positive:=25E6'+LineEnding+ + ');'+LineEnding+ + 'port('+LineEnding+ + '-- SBA Bus Interface'+LineEnding+ + ' RST_I : in std_logic; -- active high reset'+LineEnding+ + ' CLK_I : in std_logic; -- Main clock'+LineEnding+ + ' STB_I : in std_logic; -- Strobe/ChipSelect, active high'+LineEnding+ + ' WE_I : in std_logic; -- Write enable: active high, Read: active low'+LineEnding+ + ' ADR_I : in std_logic_vector;-- Address bus'+LineEnding+ + ' DAT_I : in std_logic_vector;-- Data in bus'+LineEnding+ + ' DAT_O : out std_logic_vector;-- Data Out bus'+LineEnding+ + ' INT_O : out std_logic; -- Interrupt request output'+LineEnding+ + '-- Aditional Interface'+LineEnding+ + ' P_O : out std_logic_vector(7 downto 0);'+LineEnding+ + ' P_I : in std_logic_vector(7 downto 0)'+LineEnding+ + ');'+LineEnding+ + 'end DEMO;'; +end; + +initialization + MakeIdentTable; + RegisterPlaceableHighlighter(TSynVHDLSyn); +end. + diff --git a/components/extrasyn/TestHighlighters/TestSynHighlighter.lpi b/components/extrasyn/TestHighlighters/TestSynHighlighter.lpi index b5e3fee59..07b8a9797 100644 --- a/components/extrasyn/TestHighlighters/TestSynHighlighter.lpi +++ b/components/extrasyn/TestHighlighters/TestSynHighlighter.lpi @@ -1,10 +1,12 @@ - + - + + + @@ -12,15 +14,16 @@ - - + + + - + @@ -39,12 +42,12 @@ - + - + @@ -55,12 +58,12 @@ - - - - + + + + - + @@ -69,141 +72,141 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -211,7 +214,7 @@ - + @@ -219,29 +222,30 @@ - + - + - - - - + + + + + - + @@ -249,31 +253,30 @@ - + - + - - - - + + + + - + - - + @@ -281,7 +284,7 @@ - + @@ -289,15 +292,15 @@ - + - - + + - + @@ -305,21 +308,23 @@ - + - + - + - - - + + + + + @@ -327,11 +332,11 @@ - + - + @@ -339,22 +344,22 @@ - + - + - + - + @@ -363,35 +368,35 @@ - + - + - + - + - + @@ -399,19 +404,19 @@ - + - + - + @@ -419,24 +424,22 @@ - + - + - - + - + - - + @@ -444,14 +447,14 @@ - + - + @@ -459,14 +462,14 @@ - + - + @@ -474,7 +477,7 @@ - + @@ -482,21 +485,21 @@ - + - + - + @@ -504,21 +507,21 @@ - + - + - + @@ -526,7 +529,7 @@ - + @@ -534,7 +537,7 @@ - + @@ -542,19 +545,19 @@ - + - + - + @@ -562,118 +565,118 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + @@ -681,78 +684,76 @@ - + - + - + - + - - + - + - + - + - + - + - + - + - - + - + @@ -761,7 +762,7 @@ - + @@ -769,7 +770,7 @@ - + @@ -777,164 +778,177 @@ - + - + - - + - + - - + - + - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/extrasyn/TestHighlighters/unit1.lfm b/components/extrasyn/TestHighlighters/unit1.lfm index da0665f2e..9f6971f33 100644 --- a/components/extrasyn/TestHighlighters/unit1.lfm +++ b/components/extrasyn/TestHighlighters/unit1.lfm @@ -1,7 +1,7 @@ object Form1: TForm1 - Left = 366 + Left = 641 Height = 449 - Top = 155 + Top = 230 Width = 742 Caption = 'Form1' ClientHeight = 429 @@ -9,7 +9,7 @@ object Form1: TForm1 Menu = MainMenu1 OnCreate = FormCreate OnDestroy = FormDestroy - LCLVersion = '1.9.0.0' + LCLVersion = '2.3.0.0' inline SynEdit1: TSynEdit Left = 0 Height = 429 @@ -19,7 +19,7 @@ object Form1: TForm1 Font.Height = -13 Font.Name = 'Courier New' Font.Pitch = fpFixed - Font.Quality = fqNonAntialiased + Font.Quality = fqCleartype ParentColor = False ParentFont = False TabOrder = 0 @@ -649,8 +649,8 @@ object Form1: TForm1 end end object MainMenu1: TMainMenu - left = 152 - top = 40 + Left = 152 + Top = 40 object MenuItem1: TMenuItem Caption = 'Highlighter' end diff --git a/components/extrasyn/TestHighlighters/unit1.pas b/components/extrasyn/TestHighlighters/unit1.pas index b59dbda35..e4a784660 100644 --- a/components/extrasyn/TestHighlighters/unit1.pas +++ b/components/extrasyn/TestHighlighters/unit1.pas @@ -16,7 +16,7 @@ uses SynHighlighterAsm, SynHighlighterDOT, SynHighlighterIDL, SynHighlighterKix, {SynHighlighterMsg,} SynHighlighterSDD, SynHighlighterSml, SynHighlighterURI, SynHighlighterM3, SynHighlighterRC, SynHighlighterST, SynHighlighter8051, SynHighlighterLua, SynHighlighterProlog, SynHighlighterCAC, - SynHighlighterAWK, SynHighlighterGnuplot; + SynHighlighterAWK, SynHighlighterGnuplot, SynHighlighterVHDL, SynHighlighterVerilog, SynHighlighterJSON; // SynHighlighterGeneral; @@ -86,9 +86,13 @@ procedure TForm1.FormCreate(Sender: TObject); var i, c: Integer; item: TMenuItem; + submenu: TMenuItem; hl: TSynCustomHighlighter; + hlCap: String; // highlighter caption + lastChar: Char; begin Caption := FORM_CAPTION; + SynEdit1.Font.Quality := fqClearType; FHighlighters := TFPList.Create; @@ -131,6 +135,9 @@ begin FHighlighters.Add(TSynCACSyn.Create(Self)); FHighlighters.Add(TSynSTSyn.Create(self)); FHighlighters.Add(TSynGnuplotSyn.Create(self)); + FHighlighters.Add(TSynVHDLSyn.Create(Self)); + FHighlighters.Add(TSynVerilogSyn.Create(Self)); + FHighlighters.Add(TSynJSONSyn.Create(Self)); // FHighlighters.Add(TSynCPMSyn.Create(self)); // FHighlighters.Add(TSynGeneralSyn.Create(self)); @@ -140,9 +147,18 @@ begin FHighlighters.Sort(@CompareHighlighters); + lastChar := #0; for i:=0 to FHighlighters.Count-1 do begin hl := TSynCustomHighlighter(FHighlighters[i]); if Assigned(hl) then begin + hlCap := GetHighlighterCaption(hl); + if hlCap[1] <> lastChar then + begin + lastChar := hlCap[1]; + subMenu := TMenuItem.Create(self); + subMenu.Caption := hlCap[1] + '...'; + MenuItem1.Add(subMenu); + end; SetDefaultColors(hl); item := TMenuItem.Create(self); item.Tag := i+1; //0 = unknown highlighter @@ -154,7 +170,7 @@ begin end; // item.Hint := hl.ClassName; item.OnClick := @MenuClick; - MenuItem1.Add(item); + subMenu.Add(item); end; end; diff --git a/components/extrasyn/extrahighlighters.lpk b/components/extrasyn/extrahighlighters.lpk index f61215e97..d636bec67 100644 --- a/components/extrasyn/extrahighlighters.lpk +++ b/components/extrasyn/extrahighlighters.lpk @@ -1,6 +1,6 @@ - + @@ -19,8 +19,8 @@ - - + + @@ -182,7 +182,20 @@ + + + + + + + + + + + + + diff --git a/components/extrasyn/extrahighlighters.pas b/components/extrasyn/extrahighlighters.pas index a8c1f9962..8bab9d5fd 100644 --- a/components/extrasyn/extrahighlighters.pas +++ b/components/extrasyn/extrahighlighters.pas @@ -20,7 +20,8 @@ uses SynHighlighterRC, SynHighlighterRuby, SynHighlighterSDD, SynHighlighterSml, SynHighlighterTclTk, SynHighlighterUnreal, SynHighlighterVBScript, SynHighlighterVrml97, SynHighlighter8051, SynHighlighterURI, - SynHighlighterST, SynHighlighterGeneral, synhighlightergnuplot; + SynHighlighterST, SynHighlighterGeneral, synhighlightergnuplot, + SynHighlighterVHDL, synhighlighterverilog, SynHighlighterJSON; implementation diff --git a/components/extrasyn/extrahighlighters_dsgn.lpk b/components/extrasyn/extrahighlighters_dsgn.lpk index 4b4fb4e56..ee32704d3 100644 --- a/components/extrasyn/extrahighlighters_dsgn.lpk +++ b/components/extrasyn/extrahighlighters_dsgn.lpk @@ -1,6 +1,6 @@ - + @@ -14,7 +14,7 @@ - + @@ -22,6 +22,7 @@ + diff --git a/components/extrasyn/icons/iconlist.txt b/components/extrasyn/icons/iconlist.txt index bb62f6b62..74171ae61 100644 --- a/components/extrasyn/icons/iconlist.txt +++ b/components/extrasyn/icons/iconlist.txt @@ -115,3 +115,13 @@ tsynvbscriptsyn_200.png tsynvrml97syn.png tsynvrml97syn_150.png tsynvrml97syn_200.png +tsynvhdlsyn.png +tsynvhdlsyn_150.png +tsynvhdlsyn_200.png +tsynverilogsyn.png +tsynverilogsyn_150.png +tsynverilogsyn_200.png +tsynjsonsyn.png +tsynjsonsyn_150.png +tsynjsonsyn_200.png + diff --git a/components/extrasyn/icons/tsynjsonsyn.png b/components/extrasyn/icons/tsynjsonsyn.png new file mode 100644 index 0000000000000000000000000000000000000000..b0928578bfff69ec5d969a8ba0d5da21e44900a5 GIT binary patch literal 583 zcmV-N0=WH&P)pF9CSrkbW?9;ba!ELWdK2BZ(?O2Mrm?o zcW-iQb09-gHt4*vi~s-u!AV3xR7i=nmN7^hQ5eU6&x9H=<{&s|1Ti=`RH}=pL>z<+ zk_e&>4npa4R6DkTLZ{YA9JAaIT-8bR0)kG#L1%SvkSvlc5=aP`py_q-uEsOxy+r@h zy?gKbe)qlqckfOZhQWKv3y@By{~CrN-YTgOq8y9Gx-7u+)OK#ASQC0+?##iPKg}0h;kd%7c^M z|A48y>IfB&9yRX)?y8Y`4{Y7@R1Hj*e-9)N#}|)^V!6ut)~Qq?DS+Z{=f}zz0NGrT z>V2(lKAS7njjQ)H+dW4>HdiFIe@-Hqp-`%DaeZqgN+dG?eExlCtzG(g0KnY$J$C?8 zfzA)?9A7a!*bP8x|D3N2BZNZ=;~#shr=Fc0ARJQMS77SbmkIu;5oXqQ0SE>0iRPi@JbhLA6-!>-4XfJ2f%W4h(t2O*=3$!z=z^*w}4UrGiW(FWSiUgHeELk zhZI&9M*%q4oVTsFZP7!`;OsJQ1+^+KfDpnkzsp{apx<+YuHQ7BR0vVF2Jijb@(&WR Vo6OC^qvZeq002ovPDHLkV1l)7_`m=F literal 0 HcmV?d00001 diff --git a/components/extrasyn/icons/tsynjsonsyn_150.png b/components/extrasyn/icons/tsynjsonsyn_150.png new file mode 100644 index 0000000000000000000000000000000000000000..9421dda6e3d7d97a14185a4b4d215d703c72f371 GIT binary patch literal 866 zcmV-o1D*VdP)pF9CSrkbW?9;ba!ELWdK2BZ(?O2Mrm?o zcW-iQb09-gHt4*vi~s-v+(|@1R9J=Gm`_L)Q5?rVle$FeWFYD$II!V*N)U7op@Op8 zWmiH(gAlzGTOb{RTn#!Tl&H|fKo{&H9yBV+KV6gpGl;b)6pA%EtQSqBrLh$m)9qj` zqi(sg>+0$U24>*#-iP0Jes6{+1Ofr#i4%t{u#?2Co6*tHjX)qE9JGKS2)}GLTk0;M zP%?JAJ?26qBO@u==eUb3?t~Ke9lgWhB>D)gdm&+BEP`Di3$h7<`zP7eD z($dmE*wL^J4ba&cJE1+}i(>ab9+7DYr~6u3TFA`IJQ$()C7MK6*W2`Ej5-rmRD3t z9R1vNy+!e>%+C3cvc%vRLs9~;Ssgt@BqSyqnCQODy=xbko%3P4^&Eg7%d3%07rl_; zS1}|dP+pirQ@zaE?+t1!c?`e#798{J^;cjsYCS~saUFAe>FAq6$`bJ|DBP|sqN*&H zC*vMU9Q~Y4Pr0`*sw+iceYHRvF1C^6v4K ze?DsoD>8L$ot_sn^bE}eJI#=kfMgVdGFynr2Hi1f(N&=bH;O4Q%!zoha1gc*tPb-y s#%{LpF9CSrkbW?9;ba!ELWdK2BZ(?O2Mrm?o zcW-iQb09-gHt4*vi~s-wc}YY;RA_VhPZ5rHql8uV14l=PGd_LvVfS`R(02gA7ZGD|3fk|0QWD51DPw1NxwsQ_=-{1M3-}!Uzq~+yhiWx_t1=yuL@j+G98NgXUE!i-xD9RCIfzg5g zT|9sIONU$x03+$T}zTeEKapkPfT+M6Rn^$$@nIt9_#6K!W5sKkiQLfbXlh zon5C&4kXBaB=egaMdyGdNl1p{$g153GM;_XVR5G}ItP+j{rkWwKlv+q2i9f)oqZ}# zUw_WGmYgVh2Xac{@QuPgW;9|cfTyoN6MXm<0RO3dv^MVq;LV5c^b9@Y=Ufbc>Pnd_ zT?a*dXk?Pmqe%cN${pOg+)AU@CHn2`Q}LhL$Hy--qMc`(Gpm8JG=+9=ui@B14_Z{` zZQlsQM_Qkand%}F8h{XQ6bqQz zZ?0ZvYLomu9hQ@LY012^wl?o%zt=@%LKA}bdtKbTc$8^y$lFkL6=ZHdcDPrf>mE6Ql}y68E7fR2`07Je^r zrfm-pU!{zMpTzUVvkxA41k1Z?`d8Ogm=EPYgQ(Y<3GxUtu!Xg0LSDoRp zDUk{B^pF9CSrkbW?9;ba!ELWdK2BZ(?O2Mrm?o zcW-iQb09-gHt4*vi~s-uiAh93R7i=vmcL5^VI0OkZz?*Nfwa_OP0%hm8lRyOQlldCZN|molXx0P*pY9smF$Ll91PKGMCFq8!3w7 z9$>Y|jcfrO^>(5t3W%=QY<8j)pl>IV+gl3IkyR#kpVAdzkW5@mL+~H30UNYxGu| zLa|2u>5WRY!O__r*@FtDi@K$UZ3YuTKQ|9A06aEc@%ucKF6)Ft0RSr11^}BYbCw>C z86@K~6pA&rR_6hjo(z)DM9F8OoFA?`Eq6W#yK4(9?VNCXoCRQSW069!MmQ888J`^< z;P-jBKixLRiCBb0EMktGy7-?LO$cFhzssts4rMBY(9F8uZ;P`2`{1ivFFd RV&?z=002ovPDHLkV1j2@)M)?! literal 0 HcmV?d00001 diff --git a/components/extrasyn/icons/tsynverilogsyn_150.png b/components/extrasyn/icons/tsynverilogsyn_150.png new file mode 100644 index 0000000000000000000000000000000000000000..1d18c8209eee7921da63f84bd102fb22e4a6dcc6 GIT binary patch literal 746 zcmVpF9CSrkbW?9;ba!ELWdK2BZ(?O2Mrm?o zcW-iQb09-gHt4*vi~s-vWJyFpR9J=Wm_KL}Q5?rVuT7#*d!$Qi76XA~ixgCF&_bm+ zm}|wBqJx`(ELB{jg9uWP(hMSWG0??Q#E2=VFHVIly3{{JifEE4i?N}L=^x}mJcqX7 zlBP|(BsDF5;o$v_cke#@zVH3+-4nX5(@JXl*8t_RY&W9O=x<%u#eM?_A=Z38U*`^> zN-(ObHXTSxdCVBMoMkNsWU1a|Q-MIBt{1snF2={l8wV5$h3W#TRR`BHqjs}zYHA9* z-43E`!H$i=^mOxps@hja^*bo0yoOr>AFsfEvB}4u@q%o8CG~GvrfV^D`j< z7#J8}bab@&KzrLXxOJJ+!L{tKi(w@t65#PP2B?|E(5RNP>_1R7nF5N$QlvAvVw}$8 zh{RF=jk}@ zZh~WdgclM7=iZZ9S!d?e66XWYc)pO}m)2k)|B#n>GFt+8=lU5Qg+DRe?`EXmjnknJ zyxGV6R^|Yr4~GdqP*FN;yN+$DQac?AR!bX^Sc=IFeqAR0BUb`p)LtNU z0Rh~;c8bUIpNs8n`G>stFMCV+8s}RznOmlqyKwphAHFSf_Qq43#}&S>tN}20|5DB4itW=6DdmpZZ}wMO%NNM3tkb0& ztvYX{l&Gp&{1Dc?W2_{bwH>EJG4*WARqA4fgb;f935b-k=>S5AwUW5j6EsoFe#fMY c3@vBbA6Y%hgVJm0VE_OC07*qoM6N<$g2H7}H~;_u literal 0 HcmV?d00001 diff --git a/components/extrasyn/icons/tsynverilogsyn_200.png b/components/extrasyn/icons/tsynverilogsyn_200.png new file mode 100644 index 0000000000000000000000000000000000000000..bf44c0a3cabc0b0f3b42403b09139023995e0ff7 GIT binary patch literal 855 zcmV-d1E~CoP)pF9CSrkbW?9;ba!ELWdK2BZ(?O2Mrm?o zcW-iQb09-gHt4*vi~s-v(Md!>RA_rk{%}NBWpJUL~M{p_5X;*L6@3l;T zy+vj8DtTx^ zKt5lYiJE zD3Z+`vGaW&C>QzR`E6DGwrpRh62WGvaz_g~XDw9kJ+0o9I*`^ai^hpn224u+tzuHT h!=Mp=%CYTh;1}*R)qJ1JugL%a002ovPDHLkV1idde=Gn1 literal 0 HcmV?d00001 diff --git a/components/extrasyn/icons/tsynvhdlsyn.png b/components/extrasyn/icons/tsynvhdlsyn.png new file mode 100644 index 0000000000000000000000000000000000000000..a6548d3dc7533e67b6b32468b7001c773e53851d GIT binary patch literal 536 zcmV+z0_XjSP)pF9CSrkbW?9;ba!ELWdK2BZ(?O2Mrm?o zcW-iQb09-gHt4*vi~s-ul1W5CR7i=vmOn@XF%-tXCtVb^(52YL76dH_4uT*!IEX0i z4Z1iuIvg%eu8yt_4uuQ_mo7p$KzcAIOoHS_CQyW6y)>jG)+@E z5MxXqAe*EkPe4PhnJ~rxYO>9v5|se1nJAXG5}+ZOCtkl&3($!tS{_`D{QwqTO;0F& zd(^oHP|HSZ9kf+Xvm~bLuLI4^QE96vm2D)_1!;dGT|lX9yN+`O*wy-7V0msFsq-RI7e&lY1zjfwMh9V4Y5?Fol>q<{3=AO} z4oD}iEl%L@_zsD50oi;>I*x=8;GF-ey&jxsFbso$|2ol#NHm|zob#@N5>eH85kjD! aSC=mUcbpF9CSrkbW?9;ba!ELWdK2BZ(?O2Mrm?o zcW-iQb09-gHt4*vi~s-vSV=@dR9J=Gm@!BjQ5eU6Pm@$gJCg(& zv`b7oh;4`BQXxwyUE1iHMRY3IAsOpXTBr`~OIM+E5?gdAHF0v1WRWH|NJ@Jhtl^^3 zypWtd{lme1+ZWjQ>pB0|J{KQUikHM>IONUa1)^dgF zfB-WKE3D-THSzSs5CCIS?*XX%`pumu?+69G%*BV5V3dI-@AlUKtmO(kdvvWDrxIa& zy2kXx5T$YjfERDSG7#ut@?JkaUE{&6J|!R}%Y3?q)6v1=@+OzMFW_`^pt)V_6!(tp z^W}S<+e1Djh^B!6o<1BTwX|Nnw@S*hEPBIFsa&B{t}r&z+pzupa38Neeyhf-8+oO1 zlr!XVb}|s?QEkrHNH3|Sb#BJq(B*P)S?f~jCk{?Oq?AW$e>;Aqx3-JuSKPRqopql} zDTzj-)rGL-9b+RM)Gk%ow^9osjKe1&QcBAKgb=$malI2Xp|ZEJNVc==FF5|Q+S8w; Q^#A|>07*qoM6N<$fpF9CSrkbW?9;ba!ELWdK2BZ(?O2Mrm?o zcW-iQb09-gHt4*vi~s-v=}AOERA_`aG&Y=yZ7#Xzx&?rz2Ci8>G1H7dZwY)4xE)H^FY(IUw~XgU&IAt753CT3J^F(KM~7z3y|s4WQPPodb5F(P$<8u!zUwLhUcE0-{f8R!^P>S=KCtL+g?C*RkP+WoVR$;rd zD&;C*QvQ>yY;M$@0+J*l<&`5<`yM#8_9=znOkH;h*s1>aK$Tbi>Ry402awsyq8mBk ze%W1}?5-|+or(uAIHobXv?1JYB(}^*Y+3j^?kiMlghrw9_$ofHhnGVg1@`H=b#``j zCZb)IEwPX$v6u!x@yjG%7p|?^&wu~%o9nHYg#!>$z~}Wazp{DEKEJYw&+GZ;++v!{ zc9!I%N^CStW;@GxeAPNXJ-1F`F->eVOmb4?$)lSX`v=0#3kUFg@Gbx!KYg=o=COGW zpg$5~BHD!#km+s@(jN)&VJ!oIZseF>+2qAg2i@&Klz_}YB!uF3wz@AAfTy_;UyFyS znKjEcHM54|m+>?=TDB{`O9lP%f4@(C1z;c&a^$cb;Us?bw3D4Z9o@*G8##9NbfS-M zm)-wo_K)Z-PeeF?haEuxW|uasr`g>etf*5WI2uNKIu&M?zVPPVXL>pnp}zNST>~hX zb}4Qa5QQ;!BI7;1Z0|<8mwbcl9MWfV;c9L zy*;{yU&hzsIi*)|By*!%)3g)o-fC>}Wwx>eTD=7$SSid+zTVzm3BdHbYU@Jf;6yz; z7pE2~wNG1X@)dA444f}1yFn`TZxu;&HQ}5w{jU2Q_zR4?<}wse#O?q9002ovPDHLk FV1h0`n|uHO literal 0 HcmV?d00001 diff --git a/components/extrasyn/images.res b/components/extrasyn/images.res index fbb52a928ce2d63b2f62317bde6a896334c3c7af..05cd5cb8c1516fac413267f0b2489ee79abae815 100644 GIT binary patch delta 6465 zcmbt&by!qyxAqFy3G3F(d*N=hYVKpJUqq>&aWDJ7&^x*G&U z4!-aAe&=}p{GIE1{@8n8&wke4*S+qw?t7h8<6iFIqN+jOZ?OQ1czR;6E+7xc0LqCH z_&UgT0D!cEx}A%x005x!kk$9la<=jCws5lsB(0n+t?8aTbF=n#c5`s2lh)#2Z>oF= z0H6c~8A)yVsODq|`CD8hU9C(eBsGKi6P;w(Yw>Xc<}&{tn)(3afv^2wJ*#@HEe8%+159>>nR)hitaHC>wij)P)dB@qDJ zsr`k}5I@qS$dU?u#|}_6Zfy6G2}p3Q{naT#FP>!iXp>h(O9=W@nU*ds@1Yt(`h6;A z7hqpG@Q&yWfJucX*AZpYr!twgYTg};Vlt#Lesu+qnX0J41O30(gVp<oZUSv4|MXku{K!-Pv&DR!&Zcaj{NR$U? zGC)E2br^IZ{ko)?Cf$w`KNNK>JQOL9ZUZY==$NaDO~aoG$^`}YKhwNV#AvF0ytP* z9#Cwpjlny^)k?}DkxmgmH0hP#CR6KgWj$CX=Seoe6C2h1gm&P zetAWI>axY$p{BTWv8(pBz#0Fh`M_)cdH=I83yKK^>gxv!U2>yZUfH^ zT#(bnfS@+ zkLkpVNp@+)`N1EDj5*olSs2iz^T&pGCX!>_rPOdzVD(44-E(rF6PZPt+4`$P)it)Q z)Ltn<^Tn83_$CVAx%;?mhJNMvXICkprPw#Z@wE2irl%C8@g_BXeuFYvefoo{1M%wzJP`oBSURBpMq}SSn%-3 zt~c2xIeWcxwBnDlAydSpC}7ij8x$F`WFv)8$uJF0>!S zgG#$fANc0GCh;u0dEG?NaQZqS&rzK3`MhgxaK+8VU`un838E^Imn3J86bZ_&tBqOL zoB5cY;hCkx9QEYgXn6Sw_0xyc-`RC0>oo7uziels(^O>X`-3H)Ycnx#PGwz%d~MY> zhv4t3sgbO_lmD5#0N|X+#Yl|vuX=@E^ah#zv&`N2leu=mJ8vbFi8ZLYCAzb^)cr&0 zr-Y9S?5Q|4f>YEZavi}@abKj2!+0IpDZwe95;*JmH?Zit*kKFdAYy}FEMdONxRmcm zNebncvXS-g77)9Rv1Avolc!v=HZB^^c7s|k=k}WCoAoyK_v8Eua>gL(Zy1jdBh_Xo zV`;Nq`uvj3&;aQctn0=jz@jmySijV=sKn4f4||CBeNpqS`=@)^V@VmeymE)^9$l43 zb}vcoaA2@<)k+MFjd8ZqlZlfp6SSLGRbw1^7rx&@LY_X`{8S?$SQMAgU9)0wd z$rwj@doO@R-8gt(*P^kCWrf9D^LJvI^RcK!!cZ zIrzyU{viS_O^tK9QSa&H<;j?9lFU{S$5@eqi#X_mnUQ1OPklpPAEa%)M~B~nYJOTf z;cTt+?H6yYjQX~9zBXg|w%;pxIZx4%SJ_6S&nIA1SVF8$)sjo)=7F2$O3%AAic9e4 zuXn-w0sHI#twdmz<7$O3BwKJZtg7Kmd`N949#PQ3^V zI;l>~5Tl;`lJh{w>(nDR))_r}ZF?HK&ZZ_Kh>D<=1Z>d!WrdToG-X9dEe1i#C;q~u zHpwmftFyL#!lXGZXU|P;!BafHg}eh^TuyPG65K3`T?gV#|Fte1REU8{AsI`JnvugHsS7`TItO#3B+H32se%XJVmj9q=922? z-ItB4+$8E9yMJ+s;7=#Grwhment%eJ45$Hei69NVf5a$I)PDp(s}hz4RhNV_i*QPC z^><5^At*%{UA0XlQ7}|eN-~u0mwz{E{_hl!jE`g_l)Tu4Y!HZ~O1z77#3Y|@ zD$>_`@7byHJQ{s=zTdod<@%Wu{|Pe(qTcv7FTV7zH^opXrF_jL#_Vy?3{?UgbsfHm z;_er23321kxzT+J516BW(3sbJdF2SAKJm(h--*ObIC|xhWIHn@OdH)9jMriG${Hp$ zk5e|bcHuj@ryulHK@$88sDEyp5o*?0XoMuoX_Nr7b9Bd>k=6puqq{}|d>I7=X*F~9 z*C}Y+rY%~MXg=Wdjl;2SnpDM;tBqHRHElza)RUoi@?#qEBb;!FB_#w1H~>+8(}PRV zB=)T^X%N6NiVLJYc2A~xeIK^Ob8|wi?iwg16F=dbOpk4DIxR+o&08GY=x~=+e<$6= zKOM*1`Dy&k@q#3D_p_*J7S4P>O3d8EoR|&TWhv2!+Qozdl_nS;ThQXd)obrP@n0=_SG%*s4VV!{`^#})rP5I#cWB+& zWV|!z79RarfVkNjBwLZQq=cVZUeULoqAuN<4Qy3BXRQ^C$i|S@8?$$HcRv7=+zH>r zD$xOtbHDSda<;d>(>M#sb!>b6s_hu*afB+F(vv%pph~{4)3=$Hl9F9mXp2NqHeWy@ zte>RK2`lm}YndML(1R!_D9k-Ps?QPr)4U%&Q%Blrwm-yJJbFa5aKMXOl-fC1lw7qf zq0X0z72Tnk$5U^a{&hLBLlamYa#h) zsrki&Oc<{o>S0-YH>L9gfo6~`UeVo0Sus0K=MhamIsBC_DA$bmQcbNx*Nn@a+uf{} z$BiI7W1*fz0W;-x1oiz&gXxVE5A;l<%LO)V3!D3CmsWZ=Y0HN)5U2OG=D^+k+J8(ib}&?4tNyhB;cq}JF+eHiWn+3LwW`&G-7=fR-K77zONJY|8Ht%~5GBqJzHq25g2Illb-F={N)s6gH+@%V7ZEiX6_uh5p zjgsXkkjg=bJRK7O)#%576JS>WmGJ5?9+w6Q2O3wA`saKim;!^Z?@&_`4v(HH$b~8- z*mq60;NpY)MqKV`6X9W3_e(R9++nt#uZO^?i*<+UA=-y^Z{w(WQtgofc5W&*g6esT zZwGx&90b(~@{eSyy!qOL{eG4Des;;0U*V&5AM-NzDQwCxEW`&#^NJ@-jXhZt&i32U zA_(X4ytx{mDom*L{sheycmXtP@DYCtAFDXSn`v~fVEw(^DaU{8J&5%O_K^dM*qE%RgQIdT%wM1BIgjquD5IL?=!jIbJt?9XKXP%yVxnY- zMc-1|432i&i}w6TQ@NlvQGSUZKchm7-`zuH=w+QQwe9q=1cIoTWZ0HZeqvjbvb8J7Mj!3djp&}x>3D${5oRGzj ztaKEwmuOsW?wg_+0sU7@eJynvQxDza-bh?xGM};d+DReA%|1Db8_X-K`K6}D#t%?~ z;)K3%i*4YTb6gP@kpWa@?3CI1h-Zf=(L<%jW*gofZ#tt{B^+n_2vwfHduJ-J_=YXB zif|17jfkN*nLGn>!#bQ{&TzE_U~?All=dj-?uPIu2nigJ8UjNLG6;5A{nYM`~1g@Dr|A(2vlVpI@IGIeecAJ^ zw$7+0gUZM<=v9c-G9Kqi6OqaYLbPHahu8#UTGnCh--wlBzZ^B9s|b2~Ak!O~ICqUI zZra2njio{I?SXbn;{6C5XOFb+DWj1DFoJIK*l5f8-ixtfZ3br459hV+UJ78+IDRwm z{d4iO$78Qb&-kXr(C)p-g)i`F=1j~R&-9s_+ycybf8nw84SJQ_CL=|cM z1B9R7t^AcBmVXS^|Id*B(|lm&-x^^yMNOXMkIPDIklD1N+hi0hU-VOidO&hQDyOaW zq+~*&%_K&2)FH6LhK7b-A?WC+s!?=!t&aRgo9sF2 z++K}ht5OdiK4hL+`xwKz8%A_SQyJC17->(R*b_FgF(W~b?jwDp{*h|-OZBhEEw#1$ z!^6XfiJ|g)_mG2=_eFBVmSQZ=BxvHF-7dT|G&KCu-!Dp$bG6&DM3~B7ps;j$XR^a0 z$nObIuFtBir`K(|e$A!xtNF9spd+!I0QYQ~1zePdGwnm>3nFt=N`T$~b&@fI5Al*OL> z=d@Kf|BB46sEvHx!h91-$ACRS!|K@LQI-w4#`svMyN3vy{FC@q;nWpUK4E$`zGTs4 zJ#9s*s~OK`*@M#lujg@<9SaoFnpouq)M7F)7~_MK^_Ko-2lAARBa6lpDim#BX}mId zbKDO-F4!Y=(-di~=KiU@d-klp_^sz;R7cw65m41)#*UJ#MzbFJ;|HUB-{hJwE=s%mW-SYj9 zI5Csg`okgb&3s<8Y}u2cY!`YPm?8FiL^vqg1Ewc*hTX3S(7I(*i?Lu&|T zlvJW81h#Z`c~mS7#m8l8eAQx}g~?g+;z7oat zkkU&TOsQc{u*a{`z}#g-$g+^cuIdhIue3hHr0~zqAlOmb1KBkcOhNv|(wCB1Fn4C) zu!Ur|>0USh-_Jmk*dg6`iIXqbKwwtznS8WkjLXulzZL>vzdY4+_;kc?kN z=zX^miSl-u$Lo+Y%zBl&$v{krf;yAjO__4WnA+MW{t}~3PV{-!(^OTu?yE6ZdFHgWPT7s21+>9ZS74{OW6G^$BND%;`5s<<8w zbDA)1Iz{yZbdnEkO8EySfO{QHVN#tIJnH78E^3 zxZPX%%PWQ@eJAUx_nfZzx&RMdAEQ>&WPJ{!rtGz>gJmq{(N-N;sT$E8gp~J?ncZ*T PZa!7g1GkdDX6XL~RlK#y delta 11 ScmezUmhJl%wuUW?<+A`M?*--n diff --git a/components/extrasyn/uhighlighterreg.pas b/components/extrasyn/uhighlighterreg.pas index 84decfbaf..5a2a39390 100644 --- a/components/extrasyn/uhighlighterreg.pas +++ b/components/extrasyn/uhighlighterreg.pas @@ -28,6 +28,7 @@ uses SynHighlighterHP48, SynHighlighterIDL, SynHighlighterInno, + SynHighlighterJSON, SynHighlighterKix, SynHighlighterLDraw, SynHighlighterLua, @@ -42,6 +43,8 @@ uses SynHighlighterTclTk, SynHighlighterUnreal, SynHighlighterVBScript, + SynHighlighterVerilog, + SynHighlighterVHDL, SynHighlighterVrml97; procedure Register; @@ -78,6 +81,7 @@ begin TSynHP48Syn, TSynIdlSyn, TSynInnoSyn, + TSynJSONSyn, TSynKixSyn, TSynLDRSyn, TSynLuaSyn, @@ -92,6 +96,8 @@ begin TSynTclTkSyn, TSynUnrealSyn, TSynVBScriptSyn, + TSynVerilogSyn, + TSynVHDLSyn, TSynVrml97Syn ]); end;