mwcsssyn.msg

来自「著名的Handle」· MSG 代码 · 共 167 行

MSG
167
字号
{Sample Grammar for a Cascading Stylesheets HighLighter}
{Created by tony@lad.co.za for use with xSite }

{ xSite -- Open Source freeware web development tool }
{          download it at http://xsite.lad.co.za/ }

{ Thanks: Primoz Gabrijelcic, }
{         Martin Waldenburg,  }
{         Michael Hieke <mghie@gmx.net> and... }
{         the entire mwEdit development team! }

{No syntax check takes Place}
{ DISCLAIMER:  This is provided as is, expressly without a warranty of any kind.}
{ You use it at your own risc. }

TmwCSSSyn {first Identifier is considered to be the Class Name }
tk        {second Identifier is considered to be the Identifier Prefix }
{Sensitive : Optional}
IdentStart '_', 'a'..'z', 'A'..'Z':: '_', '0'..'9', 'a'..'z', 'A'..'Z'::

KEYS  { all between KEYS and |><| is considered to be a keyword }
align
background
bottom
color
em
face
family
font
shape
size
height
horizontal
left
line
margin
overflow
padding
position
px
pt
right
text
top
vertical
weight
width
|><| { token names }
Comment
Identifier
Key
Null
Number
Space
String
Symbol
Unknown
|><|

CHARS

#0:: Null
BeginProc
  fTokenID := tkNull;
EndProc

#10:: LF
BeginProc
  fTokenID := tkSpace;
  inc(Run);
EndProc

#13:: CR
BeginProc
  fTokenID := tkSpace;
  inc(Run);
  if fLine[Run] = #10 then inc(Run);
EndProc

#1..#9, #11, #12, #14..#32:: Space
BeginProc
  inc(Run);
  fTokenID := tkSpace;
  while FLine[Run] in [#1..#9, #11, #12, #14..#32] do inc(Run);
EndProc

'{', '}':: AsciiChar
BeginProc
  fTokenID := tkString;
  inc(Run);
  while FLine[Run] in ['0'..'9'] do inc(Run);
EndProc

'#', '$'::  Integer
BeginProc
  inc(Run);
  fTokenID := tkNumber;
  while FLine[Run] in ['0'..'9', 'A'..'F', 'a'..'f'] do inc(Run);
EndProc

#39::  String
BeginProc
  fTokenID := tkString;
  if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then inc(Run, 2);
  repeat
    case FLine[Run] of
      #0, #10, #13: break;
    end;
    inc(Run);
  until FLine[Run] = #39;
  if FLine[Run] <> #0 then inc(Run);
EndProc

'0'..'9':: Number 
BeginProc
  inc(Run);
  fTokenID := tkNumber;
  while FLine[Run] in ['0'..'9', '.', 'e', 'E'] do
  begin
    case FLine[Run] of
      '.':
        if FLine[Run + 1] = '.' then break;
    end;
    inc(Run);
  end;
EndProc

'A'..'Z', 'a'..'z', '_':: Ident
BeginProc
  fTokenID := IdentKind((fLine + Run));
  inc(Run, fStringLen);
  while Identifiers[fLine[Run]] do inc(Run);
EndProc

')', '(':: RoundOpen
BeginProc
  inc(Run);
  FTokenID := tkSymbol;
EndProc

'/':: Slash
BeginProc
  inc(Run);
  if fLine[Run] = '*' then begin
    fRange := rsCStyle;
    inc(Run);
    if not (fLine[Run] in [#0, #10, #13]) then
      CStyleCommentProc;
(*
this is basically:

    fTokenID := tkComment;
    repeat
      if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin
        fRange := rsUnKnown;
        inc(Run, 2);
        break;
      end;
      inc(Run);
    until fLine[Run] in [#0, #10, #13];
*)
  end else
    fTokenID := tkSymbol;
EndProc
|><|

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?