Menu

[327ada]: / Source / VCL / SynEdit / Source / SynHighlighterRuby.pas  Maximize  Restore  History

Download this file

730 lines (653 with data), 19.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
{-------------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: SynHighlighterRuby.pas, released 2001-11-13.
The Initial Author of this file is Stefan Ascher.
Portions by Jan Verhoeven (http://jansfreeware.com/jfdelphi.htm)
"Heredoc" syntax highlighting implementation by Marko Njezic.
Unicode translation by Maël Hörz.
All Rights Reserved.
Contributors to the SynEdit and mwEdit projects are listed in the
Contributors.txt file.
Alternatively, the contents of this file may be used under the terms of the
GNU General Public License Version 2 or later (the "GPL"), in which case
the provisions of the GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms
of the GPL and not to allow others to use your version of this file
under the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the GPL.
If you do not delete the provisions above, a recipient may use your version
of this file under either the MPL or the GPL.
$Id: SynHighlighterRuby.pas,v 1.10.2.9 2008/09/14 16:25:03 maelh Exp $
You may retrieve the latest version of this file at the SynEdit home page,
located at http://SynEdit.SourceForge.net
Known Issues:
-------------------------------------------------------------------------------}
{
@abstract(Provides a Ruby highlighter for SynEdit)
@author(Stefan Ascher <stievie2002@yahoo.com>)
@created(21 May 2001)
@lastmod(2001-11-13)
The SynHighlighterVisualLisp unit provides SynEdit with a Ruby highlighter.
}
unit SynHighlighterRuby;
{$I SynEdit.inc}
interface
uses
Graphics,
SynEditTypes,
SynEditHighlighter,
SynUnicode,
SysUtils,
Classes;
type
TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSecondKey,
tkSpace, tkString, tkSymbol, tkUnknown);
{$IFDEF SYN_HEREDOC}
TRangeState = (rsUnknown, rsHeredoc, rsIndentedHeredoc);
TRangePointer = packed record
case Boolean of
True: (Ptr: Pointer);
False: (Range: Byte; Length: Byte; Checksum: Word);
end;
{$ELSE}
TRangeState = (rsUnknown);
{$ENDIF}
type
TSynRubySyn = class(TSynCustomHighlighter)
private
fRange: TRangeState;
{$IFDEF SYN_HEREDOC}
fHeredocLength: Byte;
fHeredocChecksum: Word;
{$ENDIF}
FTokenID: TtkTokenKind;
fStringAttri: TSynHighlighterAttributes;
fSymbolAttri: TSynHighlighterAttributes;
fKeyAttri: TSynHighlighterAttributes;
fSecondKeyAttri: TSynHighlighterAttributes;
fNumberAttri: TSynHighlighterAttributes;
fCommentAttri: TSynHighlighterAttributes;
fSpaceAttri: TSynHighlighterAttributes;
fIdentifierAttri: TSynHighlighterAttributes;
fKeyWords: TStrings;
fSecondKeys: TStrings;
procedure BraceOpenProc;
procedure PointCommaProc;
procedure CRProc;
procedure IdentProc;
procedure LFProc;
procedure LowerProc;
procedure NullProc;
procedure NumberProc;
procedure RoundOpenProc;
procedure SlashProc;
procedure SpaceProc;
procedure StringProc;
procedure UnknownProc;
{$IFDEF SYN_HEREDOC}
procedure HeredocProc;
{$ENDIF}
procedure SetSecondKeys(const Value: TStrings);
protected
function GetSampleSource: string; override;
function IsFilterStored: Boolean; override;
procedure NextProcedure;
public
class function GetLanguageName: string; override;
class function GetFriendlyLanguageName: string; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
override;
function GetEol: Boolean; override;
function GetRange: Pointer; override;
function GetTokenID: TtkTokenKind;
function IsKeyword(const AKeyword: string): boolean; override;
function IsSecondKeyWord(aToken: string): Boolean;
function GetTokenAttribute: TSynHighlighterAttributes; override;
function GetTokenKind: integer; override;
procedure Next; override;
procedure SetRange(Value: Pointer); override;
procedure ResetRange; override;
published
property CommentAttri: TSynHighlighterAttributes read fCommentAttri
write fCommentAttri;
property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
write fIdentifierAttri;
property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
property SecondKeyAttri: TSynHighlighterAttributes read fSecondKeyAttri
write fSecondKeyAttri;
property SecondKeyWords: TStrings read fSecondKeys write SetSecondKeys;
property NumberAttri: TSynHighlighterAttributes read fNumberAttri
write fNumberAttri;
property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
write fSpaceAttri;
property StringAttri: TSynHighlighterAttributes read fStringAttri
write fStringAttri;
property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
write fSymbolAttri;
end;
implementation
uses
SynEditMiscProcs,
SynEditStrConst;
const
RubyKeysCount = 43;
RubyKeys: array[1..RubyKeysCount] of string = (
'alias', 'attr', 'begin', 'break', 'case', 'class', 'def', 'do', 'else',
'elsif', 'end', 'ensure', 'exit', 'extend', 'false', 'for', 'gets', 'if',
'in', 'include', 'load', 'loop', 'module', 'next', 'nil', 'not', 'print',
'private', 'public', 'puts', 'raise', 'redo', 'require', 'rescue', 'retry',
'return', 'self', 'then', 'true', 'unless', 'when', 'while', 'yield');
function TSynRubySyn.IsKeyword(const AKeyword: string): Boolean;
var
First, Last, I, Compare: Integer;
Token: string;
begin
First := 0;
Last := fKeywords.Count - 1;
Result := False;
Token := SysUtils.AnsiUpperCase(AKeyword);
while First <= Last do
begin
I := (First + Last) shr 1;
Compare := WideCompareStr(fKeywords[I], Token);
if Compare = 0 then
begin
Result := True;
break;
end
else if Compare < 0 then
First := I + 1
else
Last := I - 1;
end;
end; { IsKeyWord }
function TSynRubySyn.IsSecondKeyWord(aToken: string): Boolean;
var
First, Last, I, Compare: Integer;
Token: string;
begin
First := 0;
Last := fSecondKeys.Count - 1;
Result := False;
Token := SysUtils.AnsiUpperCase(aToken);
while First <= Last do
begin
I := (First + Last) shr 1;
Compare := WideCompareStr(fSecondKeys[i], Token);
if Compare = 0 then
begin
Result := True;
break;
end
else if Compare < 0 then
First := I + 1
else
Last := I - 1;
end;
end; { IsSecondKeyWord }
constructor TSynRubySyn.Create(AOwner: TComponent);
var
i: integer;
begin
inherited Create(AOwner);
fCaseSensitive := False;
fKeyWords := TStringList.Create;
TStringList(fKeyWords).Sorted := True;
TStringList(fKeyWords).Duplicates := dupIgnore;
fSecondKeys := TStringList.Create;
TStringList(fSecondKeys).Sorted := True;
TStringList(fSecondKeys).Duplicates := dupIgnore;
if not (csDesigning in ComponentState) then
for i := 1 to RubyKeysCount do
fKeyWords.Add(RubyKeys[i]);
fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
fCommentAttri.Foreground := clMaroon;
AddAttribute(fCommentAttri);
fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
AddAttribute(fIdentifierAttri);
fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
fKeyAttri.Foreground := clBlue;
AddAttribute(fKeyAttri);
fSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord);
AddAttribute(fSecondKeyAttri);
fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
fNumberAttri.Foreground := clGreen;
AddAttribute(fNumberAttri);
fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
AddAttribute(fSpaceAttri);
fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
fStringAttri.Foreground := clPurple;
AddAttribute(fStringAttri);
fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
fSymbolAttri.Foreground := clBlue;
AddAttribute(fSymbolAttri);
SetAttributesOnChange(DefHighlightChange);
fRange := rsUnknown;
fDefaultFilter := SYNS_FilterRuby;
end; { Create }
destructor TSynRubySyn.Destroy;
begin
fKeyWords.Free;
fSecondKeys.Free;
inherited Destroy;
end; { Destroy }
procedure TSynRubySyn.BraceOpenProc;
begin
inc(Run);
fTokenID := tkSymbol;
end;
procedure TSynRubySyn.PointCommaProc;
begin
inc(Run);
fTokenID := tkSymbol;
end;
procedure TSynRubySyn.CRProc;
begin
fTokenID := tkSpace;
case FLine[Run + 1] of
#10: inc(Run, 2);
else inc(Run);
end;
end;
procedure TSynRubySyn.IdentProc;
begin
while IsIdentChar(fLine[Run]) do inc(Run);
if IsKeyWord(GetToken) then
begin
fTokenId := tkKey;
Exit;
end
else fTokenId := tkIdentifier;
if IsSecondKeyWord(GetToken) then
fTokenId := tkSecondKey
else
fTokenId := tkIdentifier;
end;
procedure TSynRubySyn.LFProc;
begin
fTokenID := tkSpace;
inc(Run);
end;
procedure TSynRubySyn.LowerProc;
{$IFDEF SYN_HEREDOC}
var
i, Len, SkipRun: Integer;
IndentedHeredoc: Boolean;
QuoteChar: WideChar;
{$ENDIF}
begin
{$IFDEF SYN_HEREDOC}
if FLine[Run + 1] = '<' then
begin
fTokenID := tkSymbol;
SkipRun := 0;
QuoteChar := #0;
if (FLine[Run + 2] = '-') and (FLine[Run + 3] in
[WideChar('"'), WideChar(''''), WideChar('`')]) then
begin
SkipRun := 2;
QuoteChar := FLine[Run + 3];
end
else
if (FLine[Run + 2] in [WideChar('-'), WideChar('"'), WideChar(''''), WideChar('`')]) then
begin
SkipRun := 1;
if FLine[Run + 2] <> '-' then
QuoteChar := FLine[Run + 2];
end;
IndentedHeredoc := (SkipRun > 0) and (FLine[Run + 2] = '-');
if IsIdentChar(FLine[Run + SkipRun + 2]) then
begin
inc(Run, 2);
i := Run;
while IsIdentChar(FLine[SkipRun + i]) do Inc(i);
Len := i - Run;
if Len > 255 then
begin
fTokenID := tkUnknown;
Exit;
end;
if (QuoteChar <> #0) and (FLine[Run + SkipRun + Len] <> QuoteChar) then
begin
fTokenID := tkUnknown;
Exit;
end;
if IndentedHeredoc then
fRange := rsIndentedHeredoc
else
fRange := rsHeredoc;
fHeredocLength := Len;
fHeredocChecksum := CalcFCS(FLine[Run + SkipRun], Len);
Inc(Run, SkipRun + Len);
fTokenID := tkString;
end
else
inc(Run, 2);
end
else
{$ENDIF}
begin
inc(Run);
fTokenID := tkSymbol;
end;
end;
procedure TSynRubySyn.NullProc;
begin
fTokenID := tkNull;
inc(Run);
end;
procedure TSynRubySyn.NumberProc;
function IsNumberChar: Boolean;
begin
case fLine[Run] of
'0'..'9', '.', 'e', 'E':
Result := True;
else
Result := False;
end;
end;
begin
inc(Run);
fTokenID := tkNumber;
while IsNumberChar do
begin
case FLine[Run] of
'.':
if FLine[Run + 1] = '.' then break;
end;
inc(Run);
end;
end;
procedure TSynRubySyn.RoundOpenProc;
begin
inc(Run);
fTokenId := tkSymbol;
end;
procedure TSynRubySyn.SlashProc;
begin
case FLine[Run] of
'/':
begin
inc(Run);
fTokenId := tkSymbol;
end;
'*':
begin
inc(Run);
fTokenId := tkSymbol;
end;
else
begin
fTokenID := tkComment;
while FLine[Run] <> #0 do
begin
case FLine[Run] of
#10, #13: break;
end;
inc(Run);
end;
end;
end;
end;
procedure TSynRubySyn.SpaceProc;
begin
inc(Run);
fTokenID := tkSpace;
while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
end;
procedure TSynRubySyn.StringProc;
var
QuoteChar: WideChar;
begin
// Ha, ha, Strings in Ruby (could be anything)!!!!
//There are three more ways to construct string literals: %q, %Q, and ``here
//documents.''
//
//%q and %Q start delimited single- and double-quoted strings.
//
//%q/general single-quoted string/ » general single-quoted string
//%Q!general double-quoted string! » general double-quoted string
//%Q{Seconds/day: #{24*60*60}} » Seconds/day: 86400
//
//The character following the ``q'' or ``Q'' is the delimiter. If it is an
//opening bracket, brace, parenthesis, or less-than sign, the string is read
//until the matching close symbol is found. Otherwise the string is read until
//the next occurrence of the same delimiter.
fTokenID := tkString;
QuoteChar := FLine[Run]; // either " or '
if (FLine[Run + 1] = QuoteChar) and (FLine[Run + 2] = QuoteChar)
then inc(Run, 2);
repeat
case FLine[Run] of
#0, #10, #13: break;
end;
inc(Run);
until FLine[Run] = QuoteChar;
if FLine[Run] <> #0 then inc(Run);
end;
procedure TSynRubySyn.UnknownProc;
begin
inc(Run);
fTokenID := tkUnknown;
end;
{$IFDEF SYN_HEREDOC}
procedure TSynRubySyn.HeredocProc;
procedure SkipToEOL;
begin
case FLine[Run] of
#0: NullProc;
#10: LFProc;
#13: CRProc;
else
repeat
inc(Run);
until IsLineEnd(Run);
end;
end;
var
i : Integer;
begin
if IsLineEnd(Run) and (fTokenPos = Run) then
begin
NextProcedure;
Exit;
end;
fTokenID := tkString;
if fRange = rsIndentedHeredoc then
while FLine[Run] in [WideChar(#9), WideChar(#32)] do Inc(Run);
if ((Run = 0) and (fRange = rsHeredoc)) or (fRange = rsIndentedHeredoc) then
begin
i := 0;
while not IsLineEnd(FLine[Run + i]) do
begin
if i > fHeredocLength then
begin
SkipToEOL;
Exit;
end;
Inc(i);
end;
if i <> fHeredocLength then
begin
SkipToEOL;
Exit;
end;
if (CalcFCS(FLine[Run], i) = fHeredocChecksum) then
begin
fRange := rsUnknown;
Run := Run + i;
Exit;
end;
end;
SkipToEOL;
end;
{$ENDIF}
procedure TSynRubySyn.Next;
begin
fTokenPos := Run;
{$IFDEF SYN_HEREDOC}
if fRange in [rsHeredoc, rsIndentedHeredoc] then
HeredocProc
else
{$ENDIF}
NextProcedure;
inherited;
end;
procedure TSynRubySyn.NextProcedure;
begin
case fLine[Run] of
'<': LowerProc;
'#': SlashProc;
'{': BraceOpenProc;
';': PointCommaProc;
#13: CRProc;
'A'..'Z', 'a'..'z', '_': IdentProc;
#10: LFProc;
#0: NullProc;
'0'..'9': NumberProc;
'(': RoundOpenProc;
'/': SlashProc;
#1..#9, #11, #12, #14..#32: SpaceProc;
#34, #39: StringProc;
else UnknownProc;
end;
end;
function TSynRubySyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
begin
case Index of
SYN_ATTR_COMMENT: Result := fCommentAttri;
SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
SYN_ATTR_KEYWORD: Result := fKeyAttri;
SYN_ATTR_STRING: Result := fStringAttri;
SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
else
Result := nil;
end;
end;
function TSynRubySyn.GetEol: Boolean;
begin
Result := Run = fLineLen + 1;
end;
function TSynRubySyn.GetRange: Pointer;
{$IFDEF SYN_HEREDOC}
var
RangePointer: TRangePointer;
{$ENDIF}
begin
{$IFDEF SYN_HEREDOC}
RangePointer.Range := Ord(fRange);
RangePointer.Length := 0;
RangePointer.Checksum := 0;
if fRange in [rsHeredoc, rsIndentedHeredoc] then
begin
RangePointer.Length := fHeredocLength;
RangePointer.Checksum := fHeredocChecksum;
end;
Result := RangePointer.Ptr;
{$ELSE}
Result := Pointer(fRange);
{$ENDIF}
end;
function TSynRubySyn.GetTokenID: TtkTokenKind;
begin
Result := fTokenId;
end;
function TSynRubySyn.GetTokenAttribute: TSynHighlighterAttributes;
begin
case fTokenID of
tkComment: Result := fCommentAttri;
tkIdentifier: Result := fIdentifierAttri;
tkKey: Result := fKeyAttri;
tkSecondKey: Result := fSecondKeyAttri;
tkNumber: Result := fNumberAttri;
tkSpace: Result := fSpaceAttri;
tkString: Result := fStringAttri;
tkSymbol: Result := fSymbolAttri;
tkUnknown: Result := fSymbolAttri;
else
Result := nil;
end;
end;
function TSynRubySyn.GetTokenKind: integer;
begin
Result := Ord(fTokenId);
end;
procedure TSynRubySyn.ResetRange;
begin
fRange := rsUnknown;
{$IFDEF SYN_HEREDOC}
fHeredocLength := 0;
fHeredocChecksum := 0;
{$ENDIF}
end;
procedure TSynRubySyn.SetRange(Value: Pointer);
{$IFDEF SYN_HEREDOC}
var
RangePointer: TRangePointer;
{$ENDIF}
begin
{$IFDEF SYN_HEREDOC}
RangePointer := TRangePointer(Value);
fRange := TRangeState(RangePointer.Range);
fHeredocLength := 0;
fHeredocChecksum := 0;
if fRange in [rsHeredoc, rsIndentedHeredoc] then
begin
fHeredocLength := RangePointer.Length;
fHeredocChecksum := RangePointer.Checksum;
end;
{$ELSE}
fRange := TRangeState(Value);
{$ENDIF}
end;
procedure TSynRubySyn.SetSecondKeys(const Value: TStrings);
var
i: Integer;
begin
if Value <> nil then
begin
Value.BeginUpdate;
for i := 0 to Value.Count - 1 do
Value[i] := SysUtils.AnsiUpperCase(Value[i]);
Value.EndUpdate;
end;
fSecondKeys.Assign(Value);
DefHighLightChange(nil);
end;
function TSynRubySyn.IsFilterStored: Boolean;
begin
Result := fDefaultFilter <> SYNS_FilterRuby;
end;
class function TSynRubySyn.GetLanguageName: string;
begin
Result := SYNS_LangRuby;
end;
function TSynRubySyn.GetSampleSource: string;
begin
Result :=
'# Factorial'+#13#10+
'def fact(n)'+#13#10+
' if n == 0'+#13#10+
' 1'+#13#10+
' else'+#13#10+
' n * fact(n-1)'+#13#10+
' end'+#13#10+
'end'+#13#10+
'print fact(ARGV[0].to_i), "\n"';
end;
class function TSynRubySyn.GetFriendlyLanguageName: string;
begin
Result := SYNS_FriendlyLangRuby;
end;
initialization
RegisterPlaceableHighlighter(TSynRubySyn);
end.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.