{********************************************************************}
{                                                                    }
{ written by TMS Software                                            }
{            copyright © 2013                                        }
{            Email : info@tmssoftware.com                            }
{            Web : http://www.tmssoftware.com                        }
{                                                                    }
{ The source code is given as is. The author is not responsible      }
{ for any possible damage done due to the use of this code.          }
{ The complete source code remains property of the author and may    }
{ not be distributed, published, given or sold in any form as such.  }
{ No parts of the source code can be included in any other component }
{ or application without written authorization of the author.        }
{********************************************************************}

unit FMX.TMSMemoStyles;

interface

{$I TMSDEFS.INC}

uses
   Classes, UITypes, FMX.TMSMemo, FMX.TMSBaseControl, FMX.Types;

{$I TMSDEFS.INC}

{$IFDEF MACOS}
  {$DEFINE GENERALOSX}
{$ENDIF}
{$IFDEF IOS}
  {$DEFINE GENERALOSX}
{$ENDIF}



const
  AllDelimiters = #32',;:.()[]=-*/^%<>#';//All the symbols
  //Next constants (keywords) is defined as comma delimmited

  AllHTMLKeyWordsDefaults = '"HEAD","META","BODY","HTML","TITLE","COMMENT"';

  AllHTMLKeyWordsStandard = '"A","B","I","U","P","BASE","BLINK","LINK","FONT","STRONG","IMG",' +
    '"BASEFONT","BGSOUND","DD","DEL","DFN","DIR","DIV","DL","DT","COL",' +
    '"BR","HR","COLGROUP","TABLE","MULTICOL","TBODY","TD","TEXTAREA",' +
    '"TFOOT","TH","THEAD","TR","TT","CAPTION","CENTER","CITE","CODE",' +
    '"BLOCKQUOTE","FORM","FRAME","IFRAME","ILAYER","FRAMESET","BUTTON",' +
    '"LABEL","LAYER","OPTION"';

  AllJSKeyWords = '"SCRIPT","OBJECT","FOR","IF","THEN","THIS","DO",' +
    '"WHILE","BREAK","{","}","(",")","SWITCH","ELSE",' +
    '"FUNCTION","WINDOW","DOCUMENT",";","RETURN","STYLE","VAR","WINDOW","LOCATION"';

  AllJSFunctions = '"alert","confirm","prompt","indexOf","select","write","focus"';


type

  [ComponentPlatformsAttribute(TMSPlatForms)]
  TTMSFMXMemoPascalStyler = class(TTMSFMXMemoCustomStyler)
  private
    FVersion: string;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property Version: string read FVersion;
    property BlockStart;
    property BlockEnd;
    property HighlightStyle;
    property LineComment;
    property MultiCommentLeft;
    property MultiCommentRight;
    property CommentStyle;
    property NumberStyle;
    property URLStyle;
    property AllStyles;
    property AutoCompletion;
    property HintParameter;
    property HexIdentifier;

    property Description;
    property Filter;
    property DefaultExtension;
    property StylerName;
    property Extensions;
  end;

  [ComponentPlatformsAttribute(TMSPlatForms)]
  TTMSFMXMemoCSSStyler = class(TTMSFMXMemoCustomStyler)
  private
    FVersion: string;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property LineComment;
    property MultiCommentLeft;
    property MultiCommentRight;
    property CommentStyle;
    property NumberStyle;
    property AllStyles;
    property Version: string read FVersion;
    property Description;
    property Filter;
    property DefaultExtension;
    property StylerName;
    property Extensions;
   end;


  [ComponentPlatformsAttribute(TMSPlatForms)]
  TTMSFMXMemoBasicStyler = class(TTMSFMXMemoCustomStyler)
  private
    FVersion: string;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property BlockStart;
    property BlockEnd;
    property LineComment;
    property MultiCommentLeft;
    property MultiCommentRight;
    property CommentStyle;
    property NumberStyle;
    property URLStyle;
    property AllStyles;
    property HexIdentifier;
    property AutoCompletion;
    property HintParameter;
    property Version: string read FVersion;
    property Description;
    property Filter;
    property DefaultExtension;
    property StylerName;
    property Extensions;
  end;

  [ComponentPlatformsAttribute(TMSPlatForms)]
  TTMSFMXMemoHTMLStyler = class(TTMSFMXMemoCustomStyler)
  private
    FVersion: string;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property LineComment;
    property MultiCommentLeft;
    property MultiCommentRight;
    property CommentStyle;
    property NumberStyle;
    property URLStyle;
//    property HighlightStyle;
    property AllStyles;

    property Version: string read FVersion;
    property Description;
    property Filter;
    property DefaultExtension;
    property StylerName;
    property Extensions;
  end;

  [ComponentPlatformsAttribute(TMSPlatForms)]
  TTMSFMXMemoJavaScriptStyler = class(TTMSFMXMemoCustomStyler)
  private
    FVersion: string;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property BlockStart;
    property BlockEnd;
    property EscapeChar;
    property LineComment;
    property MultiCommentLeft;
    property MultiCommentRight;
    property CommentStyle;
    property NumberStyle;
//    property HighlightStyle;
    property AllStyles;

    property Version: string read FVersion;
    property Description;
    property Filter;
    property DefaultExtension;
    property StylerName;
    property Extensions;
  end;

  [ComponentPlatformsAttribute(TMSPlatForms)]
  TTMSFMXMemoWebStyler = class(TTMSFMXMemoCustomStyler)
  private
    FVersion: string;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property LineComment;
    property MultiCommentLeft;
    property MultiCommentRight;
    property CommentStyle;
    property NumberStyle;
//    property HighlightStyle;
    property AllStyles;

    property Version: string read FVersion;
    property Description;
    property Filter;
    property DefaultExtension;
    property StylerName;
    property Extensions;
  end;

  [ComponentPlatformsAttribute(TMSPlatForms)]
  TTMSFMXMemoXMLStyler = class(TTMSFMXMemoCustomStyler)
  private
    FVersion: string;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property LineComment;
    property MultiCommentLeft;
    property MultiCommentRight;
    property CommentStyle;
    property NumberStyle;
    property AllStyles;

    property Version: string read FVersion;
    property Description;
    property Filter;
    property DefaultExtension;
    property StylerName;
    property Extensions;
  end;

  [ComponentPlatformsAttribute(TMSPlatForms)]
  TTMSFMXMemoSQLStyler = class(TTMSFMXMemoCustomStyler)
  private
    FVersion: string;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property AutoCompletion;
    property HintParameter;
    property LineComment;
    property MultiCommentLeft;
    property MultiCommentRight;
    property CommentStyle;
    property NumberStyle;
    property AllStyles;

    property Version: string read FVersion;
    property Description;
    property Filter;
    property DefaultExtension;
    property StylerName;
    property Extensions;
  end;

  [ComponentPlatformsAttribute(TMSPlatForms)]
  TTMSFMXMemoCSharpStyler = class(TTMSFMXMemoCustomStyler)
  private
    FVersion: string;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property BlockStart;
    property BlockEnd;
    property LineComment;
    property MultiCommentLeft;
    property MultiCommentRight;
    property CommentStyle;
    property NumberStyle;
    property AllStyles;
    property AutoCompletion;
    property HintParameter;
    property HexIdentifier;

    property Version: string read FVersion;
    property Description;
    property Filter;
    property DefaultExtension;
    property StylerName;
    property Extensions;
    property RegionDefinitions;
  end;

implementation

{ TTMSFMXMemoPascalStyler }

constructor TTMSFMXMemoPascalStyler.Create(AOwner: TComponent);
var
  itm:TElementStyle;
begin
  inherited;
  FVersion := '2.0';
  Description := 'Pascal';
  Filter := 'Pascal Files (*.pas,*.dpr,*.dpk,*.inc)|*.pas;*.dpr;*.dpk;*.inc';
  DefaultExtension := '.pas';
  StylerName := 'Pascal';
  Extensions := 'pas;dpr;dpk;inc';

  LineComment := '//';
  MultiCommentLeft := '{';
  MultiCommentRight := '}';
  CommentStyle.TextColor := TAlphaColorRec.Navy;
  CommentStyle.BkColor := TAlphaColorRec.Null;
  CommentStyle.Style := [TFontStyle.fsItalic];
  NumberStyle.TextColor := TAlphaColorRec.Fuchsia;
  NumberStyle.BkColor := TAlphaColorRec.Null;
  NumberStyle.Style := [TFontStyle.fsBold];
  BlockStart := 'begin,try,case,class,record';
  BlockEnd := 'end';
  HexIdentifier := '$';

  //------------Pascal Standard Default-------------
  itm := AllStyles.Add;
  itm.Info := 'Pascal Standard Default';
  itm.FontColor := TAlphaColorRec.Green;
  itm.Font.Style := [TFontStyle.fsBold];
  with itm.KeyWords do
  begin
    Add('UNIT');
    Add('INTERFACE');
    Add('IMPLEMENTATION');
    Add('USES');
    Add('CONST');
    Add('PROGRAM');
    Add('PRIVATE');
    Add('PUBLIC');
    Add('PUBLISHED');
    Add('PROTECTED');
    Add('PROPERTY');
    Add('FUNCTION');
    Add('FINALISE');
    Add('INITIALISE');
    Add('VAR');
    Add('BEGIN');
    Add('WITH');
    Add('END');
    Add('FOR');
    Add('TO');
    Add('DO');
    Add('NOT');
    Add('IF');
    Add('THEN');
    Add('ELSE');
    Add('TYPE');
    Add('WHILE');
    Add('REPEAT');
    Add('UNTIL');
    Add('BREAK');
    Add('CONTINUE');
    Add('VIRTUAL');
    Add('OVERRIDE');
    Add('DEFAULT');
    Add('CLASS');
    Add('STORED');
    Add('INHERITED');
    Add('PROCEDURE');
    Add('CONSTRUCTOR');
    Add('DESTRUCTOR');
    Add('FINALLY');
    Add('RAISE');
    Add('STRING');
    Add('TRY');
    Add('EXCEPT');
    Add('STDCALL');
    Add('CDECL');
    Add('PASCAL');
    Add('NIL');
    Add('CASE');
    Add('REINTRODUCE');
    Add('PACKED');
    Add('RECORD');
    Add('MESSAGE');
    Add('IN');
    Add('IS');
    Add('SHL');
    Add('SHR');
    Add('MOD');
    Add('DIV');
    Add('XOR');
    Add('OR');
    Add('AND');
    Add('OF');
    Add('SET');
    Add('DOWNTO');
    Add('EXPORTS');
    Add('LIBRARY');
    Add('AS');
    Add('ASM');
    Add('DYNAMIC');
    Add('OBJECT');
    Add('THREADVAR');
    Add('FILE');
    Add('ABSTRACT');
    Add('OVERLOAD');
    Add('ASSEMBLER');
    Add('ABSOLUTE');
    Add('AUTOMATED');
    Add('EXTERNAL');
    Add('REGISTER');
    Add('DISPINTERFACE');
    Add('RESOURCESTRING');
    Add('NEAR');
    Add('FAR');
    Add('LABEL');
    Add('OUT');
    Add('SAFECALL');
    Add('DISPID');
    Add('ARRAY');
    Add('INLINE');
    Add('FORWARD');
    Add('PLATFORM');
    Add('DEPRECATED');
  end;

  //------------Simple Quote ' '----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Simple Quote';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := #39;
  itm.BracketEnd := #39;
  //------------Double Quote " "----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Double Quote';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := '"';
  itm.BracketEnd := '"';

  //----------SYMBOL --------------
  itm := AllStyles.Add;
  itm.StyleType := stSymbol;
  itm.Info := 'Symbols Delimiters';
  itm.FontColor := TAlphaColorRec.Red;
  itm.Font.Style := [];
  itm.Symbols := #32+',;:.(){}[]=+-*/^%<>#'+#13+#10;

  //----------MULTI LINE COMMENT --------------
  itm := AllStyles.Add;
  itm.StyleType := stComment;
  itm.Info := 'Multi line comment';
  itm.CommentLeft := '(*';
  itm.CommentRight := '*)';


  with HintParameter.Parameters do
  begin
    Add('ShowMessage(const Msg: string);');
    Add('MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer);');
  end;

  with AutoCompletion do
  begin
    Add('ShowMessage()');
    Add('MessageDlg()');
  end;

  //-------------- Region Definition
  with RegionDefinitions.Add do
  begin
    Identifier := 'procedure';
    RegionStart := 'begin';
    RegionEnd := 'end';
    RegionType := rtClosed;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := 'procedure';
    RegionStart := '';
    RegionEnd := 'forward';
    RegionType := rtClosed;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := 'constructor';
    RegionStart := 'begin';
    RegionEnd := 'end';
    RegionType := rtClosed;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := 'destructor';
    RegionStart := 'begin';
    RegionEnd := 'end';
    RegionType := rtClosed;
  end;

  with RegionDefinitions.Add do
  begin
    Identifier := 'interface';
    RegionStart := 'interface';
    RegionType := rtOpen;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := 'unit';
    RegionStart := 'unit';
    RegionType := rtFile;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := 'implementation';
    RegionStart := 'implementation';
    RegionType := rtOpen;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := 'case';
    RegionStart := 'case';
    RegionEnd := 'end';
    RegionType := rtIgnore;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := 'try';
    RegionStart := 'try';
    RegionEnd := 'end';
    RegionType := rtIgnore;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := 'function';
    RegionStart := 'begin';
    RegionEnd := 'end';
    RegionType := rtClosed;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := '{$region';
    RegionStart := '{$region';
    RegionEnd := '{$endregion';
    RegionType := rtClosed;
  end;

end;


{ TTMSFMXMemoCSSStyler }
constructor TTMSFMXMemoCSSStyler.Create(AOwner: TComponent);
var
  itm: TElementStyle;
begin
  inherited;
  FVersion := '1.0';
  Description := 'Cascading Style Sheets (CSS)';
  Filter := 'Cascading Stylesheets (*.css)|*.css';
  DefaultExtension := '.css';
  StylerName := 'Cascading Style Sheets';
  Extensions := 'css';

  LineComment := '//';
  CommentStyle.TextColor := TAlphaColorRec.Navy;
  CommentStyle.BkColor := TAlphaColorRec.Null;
  CommentStyle.Style := [TFontStyle.fsItalic];
  NumberStyle.TextColor := TAlphaColorRec.Fuchsia;
  NumberStyle.BkColor := TAlphaColorRec.Null;
  NumberStyle.Style := [TFontStyle.fsBold];
  //------------CSS Standard Default-------------
  itm := AllStyles.Add;
  itm.Info:='CSS Standard Default';
  itm.FontColor := TAlphaColorRec.Green;
  itm.Font.Style := [];
  with itm.KeyWords do
    begin
      add('.H1');
      add('.H2');
      add('.H3');
      add('.H4');
      add('.H5');
      add('.BORDER');
      add('.COMMENT');
    end;
  //------------Simple Quote ' '----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Simple Quote';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := #39;
  itm.BracketEnd := #39;
  //------------Double Quote " "----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Double Quote';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := '"';
  itm.BracketEnd := '"';
  //----------SYMBOL --------------
  itm := AllStyles.Add;
  itm.StyleType := stSymbol;
  itm.Info := 'Symbols Delimiters';
  itm.FontColor := TAlphaColorRec.Teal;
  itm.Font.Style := [];
  itm.Symbols:= #32+',;:.(){}[]=-*/^%<>#'+#13+#10;
end;


{ TTMSFMXMemoBasicStyler }
constructor TTMSFMXMemoBasicStyler.Create(AOwner: TComponent);
var
  itm:TElementStyle;
begin
  inherited;
  LineComment := #39;
  FVersion := '1.0';
  Description := 'MS Visual Basic';
  Filter := 'Visual Basic Files (*.bas)|*.bas';
  DefaultExtension := '.bas';
  StylerName := 'MS Visual Basic';
  Extensions := 'bas';
  MultiCommentLeft := '{';
  MultiCommentRight := '}';
  CommentStyle.TextColor := TAlphaColorRec.Navy;
  CommentStyle.BkColor := TAlphaColorRec.Null;
  CommentStyle.Style := [TFontStyle.fsItalic];
  NumberStyle.TextColor := TAlphaColorRec.Fuchsia;
  NumberStyle.BkColor := TAlphaColorRec.Null;
  NumberStyle.Style := [TFontStyle.fsBold];
  HexIdentifier := '0x';
  BlockStart := 'begin';
  BlockEnd := 'end';
  //------------Pascal Standard Default-------------
  itm := AllStyles.Add;
  itm.Info := 'Basic Standard Default';
  itm.FontColor := TAlphaColorRec.Green;
  itm.Font.Style := [];
  with itm.KeyWords do
    begin
      add('ALIAS');
      add('ALL');
      add('AND');
      add('AS');
      add('ATTACH');
      add('AUTO');
      add('AUTOX');
      add('CALL');
      add('CASE');
      add('CFUNCTION');
      add('CLEAR');
      add('DCOMPLEX');
      add('DEC');
      add('DECLARE');
      add('DEFAULT');
      add('DIM');
      add('DO');
      add('DOUBLE');
      add('EACH');
      add('ELSE');
      add('ELSEIF');
      add('END');
      add('ENDIF');
      add('ERROR');
      add('EXIT');
      add('EXPLICIT');
      add('EXPORT');
      add('EXTERNAL');
      add('FALSE');
      add('FINALLY');
      add('FOR');
      add('FOR NEXT');
      add('FUNCADDR');
      add('FUNCTION');
      add('GIANT');
      add('GOADDR');
      add('GOSUB');
      add('GOTO');
      add('IF');
      add('IFF');
      add('IFT');
      add('IFZ');
      add('IMPORT');
      add('IN');
      add('INC');
      add('INTERNAL');
      add('IS');
      add('LIBRARYS');
      add('LOOP');
      add('MOD');
      add('MODULE');
      add('NEXT');
      add('NEW');
      add('NOT');
      add('NOTHING');
      add('OFF');
      add('ON');
      add('OPTION');
      add('OR');
      add('PRINT');
      add('PROGRAM');
      add('PROTECTED');
      add('PUBLIC');
      add('QUIT');
      add('READ');
      add('REDIM');
      add('RETURN');
      add('SBYTE');
      add('SCOMPLEX');
      add('SELECT');
      add('SHARED');
      add('SFUNCTION');
      add('SHARED');
      add('SINGLE');
      add('SLONG');
      add('SSHORT');
      add('STATIC');
      add('STEP');
      add('STOP');
      add('STRING');
      add('SUB');
      add('SUBADDR');
      add('SWAP');
      add('THEN');
      add('TO');
      add('TRUE');
      add('TRY');
      add('TYPE');
      add('TYPEOF');
      add('UBYTE');
      add('ULONG');
      add('UNION');
      add('UNTIL');
      add('USHORT');
      add('VERSION');
      add('VOID');
      add('WHEN');
      add('WHILE');
      add('WRITE');
      add('XLONG');
      add('XOR');
    end;

  //------------Simple Quote ' '----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Simple Quote';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := #39;
  itm.BracketEnd := #39;
  //------------Double Quote " "----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Double Quote';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := '"';
  itm.BracketEnd := '"';
  //----------SYMBOL --------------
  itm := AllStyles.Add;
  itm.StyleType := stSymbol;
  itm.Info := 'Symbols Delimiters';
  itm.FontColor := TAlphaColorRec.Teal;
  itm.Font.Style := [];
  itm.Symbols := #32+',;:.(){}[]=-*/^%<>#'+#13+#10;

  with AutoCompletion do
  begin
    Add('ShowMessage');
    Add('MessageDlg');
  end;

  HintParameter.HintCharDelimiter := ';';
  HintParameter.HintCharWriteDelimiter := ',';

  with HintParameter.Parameters do
  begin
    Add('ShowMessage(string Msg)');
    Add('MessageDlg(string Msg; TMsgDlgType DlgType; TMsgDlgButtons Buttons; LongInt: HelpCtx)');
  end;


end;


constructor TTMSFMXMemoWebStyler.Create(AOwner: TComponent);
var
  itm: TElementStyle;
begin
  inherited;
  FVersion := '3.0';
  Description := 'Web pages';
  Filter := 'HTML Document (*.htm,*.html)|*.htm;*.html';
  DefaultExtension := '.html';
  StylerName := 'HTML document';
  Extensions := 'html;htm';

  LineComment := '//';
  MultiCommentLeft := '<!--';
  MultiCommentRight := '-->';
  CommentStyle.TextColor := TAlphaColorRec.Silver;
  CommentStyle.BkColor := TAlphaColorRec.Null;
  CommentStyle.Style := [TFontStyle.fsItalic];
  NumberStyle.TextColor := TAlphaColorRec.Navy;
  NumberStyle.BkColor := TAlphaColorRec.Null;
  NumberStyle.Style := [TFontStyle.fsBold];
  BlockStart := '{';
  BlockEnd := '}';
  //---------Script Standard Default--------------
  itm := AllStyles.Add;
  itm.Info := 'Script Standard Default';
  itm.FontColor := TAlphaColorRec.Fuchsia;
  itm.Font.Style := [TFontStyle.fsBold];
  itm.KeyWords.CommaText := AllJSKeyWords;
  //---------HTML Standard Default--------------
  itm := AllStyles.Add;
  itm.Info := 'HTML Standard Default';
  itm.FontColor := TAlphaColorRec.Fuchsia;
  itm.Font.Style := [TFontStyle.fsBold];
  itm.KeyWords.CommaText := AllHTMLKeyWordsStandard;
  //----------Single Quote ' ' ----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Single Quote';
  itm.FontColor := TAlphaColorRec.Green;
  itm.Font.Style := [];
  itm.BracketStart := #39;
  itm.BracketEnd := #39;
  //------------Double Quote " "----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Double Quote';
  itm.FontColor := TAlphaColorRec.Teal;
  itm.Font.Style := [];
  itm.BracketStart := '"';
  itm.BracketEnd := '"';
  //----------SYMBOL --------------
  itm := AllStyles.Add;
  itm.StyleType := stSymbol;
  itm.Info := 'Symbols Delimiters';
  itm.FontColor := TAlphaColorRec.Teal;
  itm.Font.Style := [];
  itm.Symbols := AllDelimiters + #13 + #10;
  //----------Javascript functions --------------
  itm := AllStyles.Add;
  itm.Info := 'JavaScript Functions';
  itm.FontColor := TAlphaColorRec.Green;
  itm.Font.Style := [TFontStyle.fsBold];
  itm.KeyWords.CommaText := AllJSFunctions;

  with HintParameter.Parameters do
  begin
    Add('alert(message)');
    Add('confirm(message)');
    Add('prompt(message,defaultvalue)');
  end;

  with AutoCompletion do
  begin
    Add('alert');
    Add('confirm');
    Add('prompt');
  end;

end;


{ TAdvHTMLMemoStyler }

constructor TTMSFMXMemoHTMLStyler.Create(AOwner: TComponent);
var
  itm: TElementStyle;
begin
  inherited;
  FVersion := '3.0';
  Description := 'Web pages';
  Filter := 'HTML Document (*.htm,*.html)|*.htm;*.html';
  DefaultExtension := '.html';
  StylerName := 'HTML document';
  Extensions := 'htm;html';

  LineComment := '//';
  MultiCommentLeft := '<!--';
  MultiCommentRight := '-->';
  CommentStyle.TextColor := TAlphaColorRec.Silver;
  CommentStyle.BkColor := TAlphaColorRec.Null;
  CommentStyle.Style := [TFontStyle.fsItalic];
  NumberStyle.TextColor := TAlphaColorRec.Black;
  NumberStyle.BkColor := TAlphaColorRec.Null;
  NumberStyle.Style := [];
  //------------HTML Standard Default ------------------
  itm := AllStyles.Add;
  itm.StyleType := stKeyword;
  itm.Info := 'HTML Standard Default';
  itm.FontColor := TAlphaColorRec.Navy;
  itm.Font.Style := [];
  with itm.KeyWords do
  begin
    Add('&lt');
    Add('ABREV');
    Add('ACRONYM');
    Add('ADDRESS');
    Add('APPLET');
    Add('AREA');
    Add('AU');
    Add('AUTHOR');
    Add('B');
    Add('BANNER');
    Add('BASE');
    Add('BASEFONT');
    Add('BGSOUND');
    Add('BIG');
    Add('BLINK');
    Add('BLOCQUOTE');
    Add('BODY');
    Add('BQ');
    Add('BR');
    Add('CAPTION');
    Add('CENTER');
    Add('CITE');
    Add('CODE');
    Add('COL');
    Add('COLGROUP');
    Add('COMMENT');
    Add('CREDIT');
    Add('DEL');
    Add('DFN');
    Add('DIR');
    Add('DIV');
    Add('DL');
    Add('DT');
    Add('DD');
    Add('EM');
    Add('EMBED');
    Add('FIG');
    Add('FN');
    Add('FONT');
    Add('FORM');
    Add('FRAME');
    Add('FRAMESET');
    Add('HEAD');
    Add('H1');
    Add('H2');
    Add('H3');
    Add('H4');
    Add('H5');
    Add('H6');
    Add('HR');
    Add('HTML');
    Add('I');
    Add('IFRAME');
    Add('IMG');
    Add('INPUT');
    Add('INS');
    Add('ISINDEX');
    Add('KBD');
    Add('LANG');
    Add('LH');
    Add('LI');
    Add('LINK');
    Add('LISTING');
    Add('MAP');
    Add('MARQUEE');
    Add('MATH');
    Add('MENU');
    Add('META');
    Add('MULTICOL');
    Add('NOBR');
    Add('NOFRAMES');
    Add('NOTE');
    Add('OL');
    Add('OVERLAY');
    Add('P');
    Add('PARAM');
    Add('PERSON');
    Add('PLAINTEXT');
    Add('PRE');
    Add('Q');
    Add('RANGE');
    Add('SAMP');
    Add('SCRIPT');
    Add('SELECT');
    Add('SMALL');
    Add('SPACER');
    Add('SPOT');
    Add('STRIKE');
    Add('STRONG');
    Add('SUB');
    Add('SUP');
    Add('TAB');
    Add('TBODY');
    Add('TEXTAREA');
    Add('TEXTFLOW');
    Add('TFOOT');
    Add('TH');
    Add('THEAD');
    Add('TITLE');
    Add('TT');
    Add('U');
    Add('UL');
    Add('VAR');
    Add('WBR');
    Add('XMP');
    Add('DOCTYPE');
    Add('PUBLIC');
  end;
  //---------HTML Table Keywords--------------
  itm := AllStyles.Add;
  itm.Info := 'HTML Table Keywords';
  itm.FontColor := TAlphaColorRec.Olive;
  itm.Font.Style := [];
  with itm.KeyWords do
  begin
    Add('TABLE');
    Add('BORDER');
    Add('TD');
    Add('TR');
    Add('STYLE');
    Add('BORDERCOLOR');
    Add('WIDTH');
    Add('ID');
    Add('BORDERCOLORLIGHT');
    Add('BORDERCOLORDARK');
  end;
  //---------HTML Link Keywords--------------
  itm := AllStyles.Add;
  itm.Info := 'HTML Link Keywords';
  itm.FontColor := TAlphaColorRec.Red;
  itm.Font.Style := [];
  with itm.KeyWords do
  begin
    Add('A');
    Add('HREF');
  end;
  //------------Simple Bracket ' '----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Simple Bracket';
  itm.FontColor := TAlphaColorRec.White;
  itm.Font.Style := [];
  itm.BracketStart := #39;
  itm.BracketEnd := #39;
  //------------Double Bracket " "----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Double Bracket';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := '"';
  itm.BracketEnd := '"';
  //----------SYMBOL --------------
  itm := AllStyles.Add;
  itm.StyleType := stSymbol;
  itm.Info := 'Symbols Delimiters';
  itm.FontColor := TAlphaColorRec.Teal;
  itm.Font.Style := [];
  itm.Symbols := AllDelimiters + #13 + #10;
  //------------------------------

end;


{ TAdvJSMemoStyler }

constructor TTMSFMXMemoJavaScriptStyler.Create(AOwner: TComponent);
var
  itm: TElementStyle;
begin
  inherited;
  FVersion := '3.0';
  Description := 'JavaScript';
  Filter := 'Javascript Files (*.js)|*.js';
  DefaultExtension := '.js';
  StylerName := 'JavaScript';
  Extensions := 'js';
  EscapeChar := '\';

  LineComment := '//';
  MultiCommentLeft := '<!--';
  MultiCommentRight := '-->';
  BlockStart := '{';
  BlockEnd := '}';
  CommentStyle.TextColor := TAlphaColorRec.Silver;
  CommentStyle.BkColor := TAlphaColorRec.Null;
  CommentStyle.Style := [TFontStyle.fsItalic];
  NumberStyle.TextColor := TAlphaColorRec.Navy;
  NumberStyle.BkColor := TAlphaColorRec.Null;
  NumberStyle.Style := [TFontStyle.fsBold];

  //------------Script Standard Default----------------
  itm := AllStyles.Add;
  itm.Info := 'Script Standard Default';
  itm.FontColor := TAlphaColorRec.Fuchsia;
  itm.Font.Style := [TFontStyle.fsBold];
  itm.KeyWords.CommaText := AllJSKeyWords;
  //------------Simple Quote ' '----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Simple Quote';
  itm.FontColor := TAlphaColorRec.Green;
  itm.Font.Style := [];
  itm.BracketStart := #39;
  itm.BracketEnd := #39;
  //------------Double Quote " "----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Double Quote';
  itm.FontColor := TAlphaColorRec.Teal;
  itm.Font.Style := [];
  itm.BracketStart := '"';
  itm.BracketEnd := '"';
  //----------SYMBOL --------------
  itm := AllStyles.Add;
  itm.StyleType := stSymbol;
  itm.Info := 'Symbols Delimiters';
  itm.FontColor := TAlphaColorRec.Teal;
  itm.Font.Style := [];
  itm.Symbols := AllDelimiters + #13 + #10;
  //----------Javascript functions --------------
  itm := AllStyles.Add;
  itm.Info := 'JavaScript Functions';
  itm.FontColor := TAlphaColorRec.Green;
  itm.Font.Style := [TFontStyle.fsBold];
  itm.KeyWords.CommaText := AllJSFunctions;

  with HintParameter.Parameters do
  begin
    Add('alert(message)');
    Add('confirm(message)');
    Add('prompt(message,defaultvalue)');
  end;

  with AutoCompletion do
  begin
    Add('alert');
    Add('confirm');
    Add('prompt');
  end;


end;


{ TTMSFMXMemoXMLStyler }
constructor TTMSFMXMemoXMLStyler.Create(AOwner: TComponent);
var
  itm: TElementStyle;
begin
  inherited;
  FVersion := '1.0';
  Description := 'XML Files (XML)';
  Filter := 'XML Files (*.xml)|*.xml';
  DefaultExtension := '.xml';
  StylerName := 'XML Files';
  Extensions := 'xml';

  MultiCommentLeft := '<!--';
  MultiCommentRight := '-->';

  LineComment := '//';
  CommentStyle.TextColor := TAlphaColorRec.Navy;
  CommentStyle.BkColor := TAlphaColorRec.Null;
  CommentStyle.Style := [TFontStyle.fsItalic];
  NumberStyle.TextColor := TAlphaColorRec.Fuchsia;
  NumberStyle.BkColor := TAlphaColorRec.Null;
  NumberStyle.Style := [TFontStyle.fsBold];
  //------------CSS Standard Default-------------
  itm := AllStyles.Add;
  itm.Info := 'XML Default';
  itm.FontColor := TAlphaColorRec.Green;
  itm.Font.Style := [];
  with itm.KeyWords do
    begin
      Add('val');
      Add('encoding');
      Add('xml version');
      Add(']]');
      Add('![CDATA[');
      Add('![IGNORE[');
      Add('![INCLUDE[');
      Add('!ELEMENT');
      Add('!DOCTYPE');
      Add('PCDATA');
      Add('REQUIRED');
      Add('IMPLIED');
      Add('FIXED');
      Add('ENTITY');
      Add('NMTOKEN');
      Add('NMTOKENS');
      Add('NOTATION');
      Add('ID');
      Add('IDREF');
      Add('IDREFS');
      Add('xml:space');
      Add('xml:lang');
    end;
  //------------XML Comment ----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Single quote';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := #39;
  itm.BracketEnd := #39;
  //------------Double Quote " "----------------
  itm:=AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Double Quote';
  itm.FontColor := TAlphaColorRec.Black;
  itm.Font.Style := [TFontStyle.fsBold];
  itm.BracketStart := '"';
  itm.BracketEnd := '"';
  //----------SYMBOL --------------
  itm:=AllStyles.Add;
  itm.StyleType:=stSymbol;
  itm.Info := 'XML delimiters';
  itm.FontColor := TAlphaColorRec.Teal;
  itm.Font.Style := [];
  itm.Symbols := #32+'=<?/>#'+#13+#10;


end;



{ TTMSFMXMemoSQLStyler }
constructor TTMSFMXMemoSQLStyler.Create(AOwner: TComponent);
var
  itm:TElementStyle;
begin
  inherited;
  FVersion := '1.0';
  Description := 'SQL';
  Filter := 'SQL Files (*.sql)|*.sql';
  DefaultExtension := '.sql';
  StylerName := 'SQL';
  Extensions := 'sql';

  LineComment := #39;
  MultiCommentLeft := '{';
  MultiCommentRight := '}';
  CommentStyle.TextColor := TAlphaColorRec.Navy;
  CommentStyle.BkColor := TAlphaColorRec.Null;
  CommentStyle.Style := [TFontStyle.fsItalic];
  NumberStyle.TextColor := TAlphaColorRec.Fuchsia;
  NumberStyle.BkColor := TAlphaColorRec.Null;
  NumberStyle.Style := [TFontStyle.fsBold];
  //------------Pascal Standard Default-------------
  itm := AllStyles.Add;
  itm.Info := 'SQL Standard Default';
  itm.FontColor := TAlphaColorRec.Green;
  itm.Font.Style := [];
  with itm.KeyWords do
    begin
      Add('Proc');
      Add('Procedure');
      Add('Begin');
      Add('End');
      Add('While');
      Add('BEGIN');
      Add('END');
      Add('FOR');
      Add('TO');
      Add('DO');
      Add('NOT');
      Add('IF');
      Add('ELSE');
      Add('WHILE');
      Add('REPEAT');
      Add('UNTIL');
      Add('BREAK');
      Add('CONTINUE');
      Add('EXEC');
      Add('Insert');
      Add('Values');
      Add('Update');
      Add('From');
      Add('Delete');
      Add('Declare');
      Add('Set');
      Add('Open');
      Add('Fetch');
      Add('Close');
      Add('Deallocate');
      Add('Return');
      Add('Rollback');
      Add('Transaction');
      Add('Trans');
      Add('and');
      Add('or');
      Add('Order');
      Add('By');
      Add('Group');
      Add('Having');
      Add('Where');
      Add('Left');
      Add('Right');
      Add('Join');
      Add('Inner');
      Add('Outer');
      Add('On');
      Add('Create');
      Add('Delete');
      Add('Select');
      Add('Like');
    end;

  //------------Double Quote " "----------------
  itm :=AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Double Quote';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := '"';
  itm.BracketEnd := '"';
  //----------SYMBOL --------------
  itm := AllStyles.Add;
  itm.StyleType := stSymbol;
  itm.Info:='Symbols Delimiters';
  itm.FontColor := TAlphaColorRec.Teal;
  itm.Font.Style := [];
  itm.Symbols:= #32+',;:.(){}[]=-*/^%<>#'+#13+#10;

  AutoCompletion.Add('SELECT');
  AutoCompletion.Add('WHERE');
end;


{ TTMSFMXMemoCSharpStyler }

constructor TTMSFMXMemoCSharpStyler.Create(AOwner: TComponent);
var
  itm: TElementStyle;
begin
  inherited;
  FVersion := '1.0';
  Description := 'C# Styler';
  Filter := 'C# files|*.cs';
  DefaultExtension := '.';
  StylerName := 'C# Styler';
  Extensions := 'cs';

  LineComment := '//';
  MultiCommentLeft := '/*';
  MultiCommentRight := '*/';
  CommentStyle.TextColor := TAlphaColorRec.Navy;
  CommentStyle.BkColor := TAlphaColorRec.Null;
  CommentStyle.Style := [TFontStyle.fsItalic];
  NumberStyle.TextColor := TAlphaColorRec.Fuchsia;
  NumberStyle.BkColor := TAlphaColorRec.Null;
  NumberStyle.Style := [TFontStyle.fsBold];
  BlockStart := '{';
  BlockEnd := '}';
  Literal := '\';
  HexIdentifier := '0x';

  //------------C# Standard Default-------------
  itm := AllStyles.Add;
  itm.Info := 'C# Standard Default';
  itm.FontColor := TAlphaColorRec.Green;
  itm.Font.Style := [TFontStyle.fsBold];
  with itm.KeyWords do
  begin
    Add('NAMESPACE');
    Add('USING');
    Add('GET');
    Add('SET');
    Add('PRIVATE');
    Add('PUBLIC');
    Add('INTERNAL');

    Add('TYPEOF');
    Add('TYPE');
    Add('INTERFACE');
    Add('DELEGATE');
    Add('EVENT');

    Add('IF');
    Add('ELSE');

    Add('SWITCH');
    Add('CASE');
    Add('DEFAULT');

    Add('DO');
    Add('WHILE');

    Add('FOR');
    Add('FOREACH');
    Add('BREAK');
    Add('CONTINUE');
    Add('RETURN');
    Add('THROW');
    Add('CATCH');
    Add('TRY');
    Add('FINALLY');
    Add('CHECKED');
    Add('UNCHECKED');
    Add('LOCK');

    Add('THIS');
    Add('VALUE');
    Add('TRUE');
    Add('FALSE');
    Add('NULL');

    Add('CLASS');
    Add('STRUCT');

    Add('STATIC');
    Add('VOID');
    Add('UNSAFE');
    Add('INT');
    Add('BOOL');
    Add('STRING');
    Add('OBJECT');
    Add('SBYTE');
    Add('SHORT');
    Add('LONG');
    Add('USHORT');
    Add('UBYTE');
    Add('UINT');
    Add('ULONG');
    Add('FLOAT');
    Add('DOUBLE');
    Add('CHAR');
    Add('DECIMAL');
    Add('ENUM');

    Add('IMPLEMENTATION');
    Add('CONST');
    Add('PROGRAM');
    Add('PUBLISHED');
    Add('PROTECTED');
    Add('SEALED');
    Add('PROPERTY');

    Add('FUNCTION');

    Add('PARAMS');
    Add('REF');
    Add('BASE');
    Add('EXTERN');
    Add('OPERATOR');

    Add('GOTO');

    Add('NOT');
    Add('TO');

    Add('IS');

    Add('EXPLICIT');
    Add('IMPLICIT');
    Add('ABSTRACT');
    Add('VIRTUAL');
    Add('OVERRIDE');
    Add('READONLY');
    Add('DEFAULT');
    Add('FIXED');
  end;

  itm := AllStyles.Add;
  itm.Info := 'C# Regions';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [TFontStyle.fsBold];
  with itm.KeyWords do
  begin
    Add('#region');
    Add('#endregion');
  end;

  itm := AllStyles.Add;
  itm.Info := 'C# Conditional defines';
  itm.FontColor := TAlphaColorRec.Navy;
  itm.Font.Style := [TFontStyle.fsBold];
  with itm.KeyWords do
  begin
    Add('#if');
    Add('#else');
    Add('#endif');
    Add('#define');
    Add('#undef');
    Add('#error');
    Add('#warning');
    Add('#line');
  end;

  //------------Simple Quote ' '----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Simple Quote';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := #39;
  itm.BracketEnd := #39;
  //------------Double Quote " "----------------
  itm := AllStyles.Add;
  itm.StyleType := stBracket;
  itm.Info := 'Double Quote';
  itm.FontColor := TAlphaColorRec.Blue;
  itm.Font.Style := [];
  itm.BracketStart := '"';
  itm.BracketEnd := '"';
  //----------SYMBOL --------------
  itm := AllStyles.Add;
  itm.StyleType := stSymbol;
  itm.Info := 'Symbols Delimiters';
  itm.FontColor := TAlphaColorRec.Red;
  itm.Font.Style := [];
  itm.Symbols := #32+',;:.()[]=-*/^%&^<>|!~'+#13+#10;

  //-------------- Region Definition
  with RegionDefinitions.Add do
  begin
    Identifier := 'namespace';
    RegionStart := '{';
    RegionEnd := '}';
    RegionType := rtClosed;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := '#region';
    RegionStart := '#region';
    RegionEnd := '#endregion';
    RegionType := rtClosed;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := 'public';
    RegionStart := '{';
    RegionEnd := '}';
    RegionType := rtClosed;
  end;
  with RegionDefinitions.Add do
  begin
    Identifier := 'private';
    RegionStart := '{';
    RegionEnd := '}';
    RegionType := rtClosed;
  end;

end;


end.
