Explorar o código

Merged revisions 3792,3859 via svnmerge from
http://[email protected]/svn/fpc/trunk

........
r3792 | michael | 2006-06-04 18:32:20 +0200 (Sun, 04 Jun 2006) | 1 line

+ Updated default config file for FPC
........
r3859 | michael | 2006-06-13 21:34:49 +0200 (Tue, 13 Jun 2006) | 1 line

+ Fixed syntax highlighting. Asm blocks now also correct
........

git-svn-id: branches/fixes_2_0@3964 -

peter %!s(int64=19) %!d(string=hai) anos
pai
achega
25f8628b18
Modificáronse 3 ficheiros con 278 adicións e 307 borrados
  1. 9 13
      compiler/utils/fpc.cft
  2. 210 215
      compiler/utils/fpccfg.inc
  3. 59 79
      utils/fpdoc/dw_html.pp

+ 9 - 13
compiler/utils/fpc.cft

@@ -22,14 +22,14 @@
 
 # For a release compile with optimizes and strip debuginfo
 #IFDEF RELEASE
-  -OG2p3
+  -O2p3
   -Xs
   #WRITE Compiling Release Version
 #ENDIF
 
 # For a debug version compile with debuginfo and all codegeneration checks on
 #IFDEF DEBUG
-  -g
+  -glh
   -Crtoi
   #WRITE Compiling Debug Version
 #ENDIF
@@ -97,20 +97,16 @@
 #-Ct
 
 # Optimizer switches for i386 compiler
-# -Og        generate smaller code
-# -OG        generate faster code (default)
-# -Or        keep certain variables in registers (still BUGGY!!!)
-# -Ou        enable uncertain optimizations (see docs)
+# -Os        generate smaller code
 # -O1        level 1 optimizations (quick optimizations)
 # -O2        level 2 optimizations (-O1 + slower optimizations)
 # -O3        level 3 optimizations (same as -O2u)
-# -Op        target processor
-#     -Op1  set target processor to 386/486
-#     -Op2  set target processor to Pentium/PentiumMMX (tm)
-#     -Op3  set target processor to PPro/PII/c6x86/K6 (tm)
-
-# Optimize always for Size and PII
-#-OG2p3
+# -Oa=N      set alignment to N
+# -OoX       switch on optimalization X. 
+# -OoNOX     switch off optimalization X.
+#               X is one of REGVAR UNCERTAIN STACKFRAME PEEPHOLE ASMCSE LOOPUNROLL
+# -OpCPU     set target processor.
+#             CPU is one of 386, PENTIUM, PENTIUM2, PENTIUM3, PENTIUM4, PENTIUMM 
 
 
 # -----------------------

+ 210 - 215
compiler/utils/fpccfg.inc

@@ -1,224 +1,219 @@
 {$ifdef Delphi}
-const DefaultConfig : array[0..24] of string[240]=(
+const DefaultConfig : array[0..23] of string[240]=(
 {$else Delphi}
-const DefaultConfig : array[0..24,1..240] of char=(
+const DefaultConfig : array[0..23,1..240] of char=(
 {$endif Delphi}
-  '#'#013#010+
-  '# Config file generated by fpcmkcfg on %BUILDDATE% - %BUILDTIME%'#013#010+
-  '# Example fpc.cfg for Free Pascal Compiler'#013#010+
-  '#'#013#010+
-  #013#010+
-  '# ----------------------'#013#010+
-  '# Defines (preprocessor)'#013#010+
-  '# ----------------------'#013#010+
-  #013#010+
-  '#'#013#010+
-  '# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE',', #DEFINE, #UNDEF are allowed'+
-  #013#010+
-  '#'#013#010+
-  '# -d is the same as #DEFINE'#013#010+
-  '# -u is the same as #UNDEF'#013#010+
-  '#'#013#010+
-  #013#010+
-  '#'#013#010+
-  '# Some examples (for switches see below, and the -? helppages)'#013#010+
-  '#'#013#010+
-  '# Try compiling with the -dRELEASE or -dDEBUG on the commandline'#013#010+
-  '#'#013#010+
-  #013#010+
-  '# F','or a release compile with optimizes and strip debuginfo'#013#010+
-  '#IFDEF RELEASE'#013#010+
-  '  -OG2p3'#013#010+
-  '  -Xs'#013#010+
-  '  #WRITE Compiling Release Version'#013#010+
-  '#ENDIF'#013#010+
-  #013#010+
+  '#'#010+
+  '# Config file generated by fpcmkcfg on %BUILDDATE% - %BUILDTIME%'#010+
+  '# Example fpc.cfg for Free Pascal Compiler'#010+
+  '#'#010+
+  #010+
+  '# ----------------------'#010+
+  '# Defines (preprocessor)'#010+
+  '# ----------------------'#010+
+  #010+
+  '#'#010+
+  '# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE,',' #UNDEF are allowed'+
+  #010+
+  '#'#010+
+  '# -d is the same as #DEFINE'#010+
+  '# -u is the same as #UNDEF'#010+
+  '#'#010+
+  #010+
+  '#'#010+
+  '# Some examples (for switches see below, and the -? helppages)'#010+
+  '#'#010+
+  '# Try compiling with the -dRELEASE or -dDEBUG on the commandline'#010+
+  '#'#010+
+  #010+
+  '# For a release compile w','ith optimizes and strip debuginfo'#010+
+  '#IFDEF RELEASE'#010+
+  '  -O2p3'#010+
+  '  -Xs'#010+
+  '  #WRITE Compiling Release Version'#010+
+  '#ENDIF'#010+
+  #010+
   '# For a debug version compile with debuginfo and all codegeneration ch'+
-  'ecks on'#013#010+
-  '#IFDEF DEBUG'#013#010+
-  '  -g'#013#010+
-  '  -Cr','toi'#013#010+
-  '  #WRITE Compiling Debug Version'#013#010+
-  '#ENDIF'#013#010+
-  #013#010+
-  '# ----------------'#013#010+
-  '# Parsing switches'#013#010+
-  '# ----------------'#013#010+
-  #013#010+
-  '# Pascal language mode'#013#010+
-  '#      -Mfpc      free pascal dialect (default)'#013#010+
-  '#      -Mobjfpc   switch some Delphi 2 extensions on'#013#010+
-  '# ','     -Mdelphi   tries to be Delphi compatible'#013#010+
-  '#      -Mtp       tries to be TP/BP 7.0 compatible'#013#010+
-  '#      -Mgpc      tries to be gpc compatible'#013#010+
+  'ecks on'#010+
+  '#IFDEF DEBUG'#010+
+  '  -glh'#010+
+  '  -Crtoi'#010+
+  '  #WRITE Compiling Debug Ve','rsion'#010+
+  '#ENDIF'#010+
+  #010+
+  '# ----------------'#010+
+  '# Parsing switches'#010+
+  '# ----------------'#010+
+  #010+
+  '# Pascal language mode'#010+
+  '#      -Mfpc      free pascal dialect (default)'#010+
+  '#      -Mobjfpc   switch some Delphi 2 extensions on'#010+
+  '#      -Mdelphi   tries to be Delphi compati','ble'#010+
+  '#      -Mtp       tries to be TP/BP 7.0 compatible'#010+
+  '#      -Mgpc      tries to be gpc compatible'#010+
   '#      -Mmacpas   tries to be compatible to the macintosh pascal diale'+
-  'cts'#013#010+
-  '#'#013#010+
-  '# Turn on Object ','Pascal extensions by default'#013#010+
-  '#-Mobjfpc'#013#010+
-  #013#010+
-  '# Assembler reader mode'#013#010+
-  '#      -Rdefault  use default assembler'#013#010+
-  '#      -Ratt      read AT&T style assembler'#013#010+
-  '#      -Rintel    read Intel style assembler'#013#010+
-  '#'#013#010+
-  '# All assembler blocks are AT&T style','d by default'#013#010+
-  '#-Ratt'#013#010+
-  #013#010+
-  '# Semantic checking'#013#010+
-  '#      -S2        same as -Mobjfpc'#013#010+
-  '#      -Sc        supports operators like C (*=,+=,/= and -=)'#013#010+
-  '#      -Sa        include assertion code.'#013#010+
-  '#      -Sd        same as -Mdelphi'#013#010+
-  '#      -Se<x>    ',' compiler stops after the <x> errors (default is 1)'+
-  #013#010+
-  '#      -Sg        allow LABEL and GOTO'#013#010+
-  '#      -Sh        Use ansistrings'#013#010+
-  '#      -Si        support C++ styled INLINE'#013#010+
-  '#      -SI<x>     set interface style to <x>'#013#010+
-  '#         -SIcomCOM c','ompatible interface (default)'#013#010+
-  '#         -SIcorbaCORBA compatible interface'#013#010+
-  '#      -Sm        support macros like C (global)'#013#010+
-  '#      -So        same as -Mtp'#013#010+
-  '#      -Sp        same as -Mgpc'#013#010+
-  '#      -Ss        constructor name must be init ','(destructor must be '+
-  'done)'#013#010+
-  '#      -St        allow static keyword in objects'#013#010+
-  '#'#013#010+
-  '# Allow goto, inline, C-operators, C-vars'#013#010+
-  '-Sgic'#013#010+
-  #013#010+
-  '# ---------------'#013#010+
-  '# Code generation'#013#010+
-  '# ---------------'#013#010+
-  #013#010+
-  '# Uncomment the next line if you always want sta','tic/dynamic units by'+
-  ' default'#013#010+
-  '# (can be overruled with -CD, -CS at the commandline)'#013#010+
-  '#-CS'#013#010+
-  '#-CD'#013#010+
-  #013#010+
-  '# Set the default heapsize to 8Mb'#013#010+
-  '#-Ch8000000'#013#010+
-  #013#010+
-  '# Set default codegeneration checks (iocheck, overflow, range, stack)'#013+
-  #010+
-  '#-Ci'#013#010+
-  '#-Co'#013#010+
-  '#-Cr'#013#010+
-  '#-','Ct'#013#010+
-  #013#010+
-  '# Optimizer switches for i386 compiler'#013#010+
-  '# -Og        generate smaller code'#013#010+
-  '# -OG        generate faster code (default)'#013#010+
-  '# -Or        keep certain variables in registers (still BUGGY!!!)'#013#010+
-  '# -Ou        enable uncertain optimizations (s','ee docs)'#013#010+
-  '# -O1        level 1 optimizations (quick optimizations)'#013#010+
-  '# -O2        level 2 optimizations (-O1 + slower optimizations)'#013#010+
-  '# -O3        level 3 optimizations (same as -O2u)'#013#010+
-  '# -Op        target processor'#013#010+
-  '#     -Op1  set target pr','ocessor to 386/486'#013#010+
-  '#     -Op2  set target processor to Pentium/PentiumMMX (tm)'#013#010+
-  '#     -Op3  set target processor to PPro/PII/c6x86/K6 (tm)'#013#010+
-  #013#010+
-  '# Optimize always for Size and PII'#013#010+
-  '#-OG2p3'#013#010+
-  #013#010+
-  #013#010+
-  '# -----------------------'#013#010+
-  '# Set Filenames and P','aths'#013#010+
-  '# -----------------------'#013#010+
-  #013#010+
-  '# Both slashes and backslashes are allowed in paths'#013#010+
-  #013#010+
+  'cts'#010+
+  '#'#010+
+  '# Turn on Object Pascal extensions by default'#010+
+  '#-Mobjfpc'#010+
+  #010+
+  '# Assem','bler reader mode'#010+
+  '#      -Rdefault  use default assembler'#010+
+  '#      -Ratt      read AT&T style assembler'#010+
+  '#      -Rintel    read Intel style assembler'#010+
+  '#'#010+
+  '# All assembler blocks are AT&T styled by default'#010+
+  '#-Ratt'#010+
+  #010+
+  '# Semantic checking'#010+
+  '#      -S2    ','    same as -Mobjfpc'#010+
+  '#      -Sc        supports operators like C (*=,+=,/= and -=)'#010+
+  '#      -Sa        include assertion code.'#010+
+  '#      -Sd        same as -Mdelphi'#010+
+  '#      -Se<x>     compiler stops after the <x> errors (default is 1)'#010+
+  '#      -Sg ','       allow LABEL and GOTO'#010+
+  '#      -Sh        Use ansistrings'#010+
+  '#      -Si        support C++ styled INLINE'#010+
+  '#      -SI<x>     set interface style to <x>'#010+
+  '#         -SIcomCOM compatible interface (default)'#010+
+  '#         -SIcorbaCORBA compatible int','erface'#010+
+  '#      -Sm        support macros like C (global)'#010+
+  '#      -So        same as -Mtp'#010+
+  '#      -Sp        same as -Mgpc'#010+
+  '#      -Ss        constructor name must be init (destructor must be do'+
+  'ne)'#010+
+  '#      -St        allow static keyword in objec','ts'#010+
+  '#'#010+
+  '# Allow goto, inline, C-operators, C-vars'#010+
+  '-Sgic'#010+
+  #010+
+  '# ---------------'#010+
+  '# Code generation'#010+
+  '# ---------------'#010+
+  #010+
+  '# Uncomment the next line if you always want static/dynamic units by d'+
+  'efault'#010+
+  '# (can be overruled with -CD, -CS at the commandline)'#010,
+  '#-CS'#010+
+  '#-CD'#010+
+  #010+
+  '# Set the default heapsize to 8Mb'#010+
+  '#-Ch8000000'#010+
+  #010+
+  '# Set default codegeneration checks (iocheck, overflow, range, stack)'#010+
+  '#-Ci'#010+
+  '#-Co'#010+
+  '#-Cr'#010+
+  '#-Ct'#010+
+  #010+
+  '# Optimizer switches for i386 compiler'#010+
+  '# -Os        generate smaller code'#010+
+  '# -O1        leve','l 1 optimizations (quick optimizations)'#010+
+  '# -O2        level 2 optimizations (-O1 + slower optimizations)'#010+
+  '# -O3        level 3 optimizations (same as -O2u)'#010+
+  '# -Oa=N      set alignment to N'#010+
+  '# -OoX       switch on optimalization X. '#010+
+  '# -OoNOX    ',' switch off optimalization X.'#010+
+  '#               X is one of REGVAR UNCERTAIN STACKFRAME PEEPHOLE ASMCS'+
+  'E LOOPUNROLL'#010+
+  '# -OpCPU     set target processor.'#010+
+  '#             CPU is one of 386, PENTIUM, PENTIUM2, PENTIUM3, PENTIUM4'+
+  ', PENTIUMM '#010+
+  #010+
+  #010+
+  '# ------','-----------------'#010+
+  '# Set Filenames and Paths'#010+
+  '# -----------------------'#010+
+  #010+
+  '# Both slashes and backslashes are allowed in paths'#010+
+  #010+
   '# path to the messagefile, not necessary anymore but can be used to ov'+
-  'erride'#013#010+
-  '# the default language'#013#010+
-  '#-Fr%basepath%/msg/errore.msg'#013#010+
-  '#-Fr%basepath%/ms','g/errorn.msg'#013#010+
-  '#-Fr%basepath%/msg/errores.msg'#013#010+
-  '#-Fr%basepath%/msg/errord.msg'#013#010+
-  '#-Fr%basepath%/msg/errorr.msg'#013#010+
-  #013#010+
-  '# path to the gcclib'#013#010+
-  '#-Fl%basepath%/lib'#013#010+
-  #013#010+
-  '# searchpath for includefiles'#013#010+
-  '#-Fi/pp/inc;/pp/rtl/inc'#013#010+
-  #013#010+
-  '# searchpath for includefile','s'#013#010+
-  '# release them only if you know what you do'#013#010+
-  '# because this could cause a rebuild of the runtime library'#013#010+
-  '# if you tell them compiler/ide to build the project (FK)'#013#010+
-  '#-Fi%basepath%/source/rtl/inc;%basepath%/source/rtl/i386'#013#010+
-  #013#010+
-  '# searchpath',' for objectfiles'#013#010+
-  '#-Fo%basepath%/source/rtl/inc;%basepath%/source/rtl/i386'#013#010+
-  #013#010+
-  '# searchpath for units and other system dependent things'#013#010+
-  '-Fu%basepath%/units/$FPCTARGET/'#013#010+
-  '-Fu%basepath%/units/$FPCTARGET/*'#013#010+
-  '-Fu%basepath%/units/$FPCTARGET/rtl'#013#010+
-  #013,#010+
-  '# searchpath for libraries'#013#010+
-  '#-Fl%basepath%/lib'#013#010+
-  '#-Fl/lib;/usr/lib'#013#010+
-  #013#010+
-  '# searchpath for tools'#013#010+
-  '-FD%basepath%/bin/$FPCTARGET'#013#010+
-  #013#010+
-  #013#010+
-  '# -------------'#013#010+
-  '# Linking'#013#010+
-  '# -------------'#013#010+
-  #013#010+
-  '# generate always debugging information for GDB (slows down the c','omp'+
-  'iling'#013#010+
-  '# process)'#013#010+
-  '#      -gc        generate checks for pointers'#013#010+
-  '#      -gd        use dbx'#013#010+
-  '#      -gg        use gsym'#013#010+
-  '#      -gh        use heap trace unit (for memory leak debugging)'#013#010+
-  '#      -gl        use line info unit to show mor','e info for backtrace'+
-  's'#013#010+
-  '#      -gv        generates programs tracable with valgrind'#013#010+
-  '#      -gw        generate dwarf debugging info'#013#010+
-  '#'#013#010+
-  '# Enable debuginfo and use the line info unit by default'#013#010+
-  '#-gl'#013#010+
-  #013#010+
-  '# always pass an option to the linker'#013,#010+
-  '#-k-s'#013#010+
-  #013#010+
-  '# Always strip debuginfo from the executable'#013#010+
-  '-Xs'#013#010+
-  #013#010+
-  #013#010+
-  '# -------------'#013#010+
-  '# Miscellaneous'#013#010+
-  '# -------------'#013#010+
-  #013#010+
-  '# Write always a nice FPC logo ;)'#013#010+
-  '-l'#013#010+
-  #013#010+
-  '# Verbosity'#013#010+
-  '#      e : Show errors (default)       d : Show debug info'#013#010+
-  '#      w',' : Show warnings               u : Show unit info'#013#010+
-  '#      n : Show notes                  t : Show tried/used files'#013#010+
-  '#      h : Show hints                  m : Show defined macros'#013#010+
-  '#      i : Show general info           p : Show compiled pr','ocedures'#013+
-  #010+
-  '#      l : Show linenumbers            c : Show conditionals'#013#010+
+  'erride'#010+
+  '# the default language'#010+
+  '#-Fr%basepath%/m','sg/errore.msg'#010+
+  '#-Fr%basepath%/msg/errorn.msg'#010+
+  '#-Fr%basepath%/msg/errores.msg'#010+
+  '#-Fr%basepath%/msg/errord.msg'#010+
+  '#-Fr%basepath%/msg/errorr.msg'#010+
+  #010+
+  '# path to the gcclib'#010+
+  '#-Fl%basepath%/lib'#010+
+  #010+
+  '# searchpath for includefiles'#010+
+  '#-Fi/pp/inc;/pp/rtl/inc'#010+
+  #010+
+  '# search','path for includefiles'#010+
+  '# release them only if you know what you do'#010+
+  '# because this could cause a rebuild of the runtime library'#010+
+  '# if you tell them compiler/ide to build the project (FK)'#010+
+  '#-Fi%basepath%/source/rtl/inc;%basepath%/source/rtl/i386',#010+
+  #010+
+  '# searchpath for objectfiles'#010+
+  '#-Fo%basepath%/source/rtl/inc;%basepath%/source/rtl/i386'#010+
+  #010+
+  '# searchpath for units and other system dependent things'#010+
+  '-Fu%basepath%/units/$FPCTARGET/'#010+
+  '-Fu%basepath%/units/$FPCTARGET/*'#010+
+  '-Fu%basepath%/units/$FPCTARGE','T/rtl'#010+
+  #010+
+  '# searchpath for libraries'#010+
+  '#-Fl%basepath%/lib'#010+
+  '#-Fl/lib;/usr/lib'#010+
+  #010+
+  '# searchpath for tools'#010+
+  '-FD%basepath%/bin/$FPCTARGET'#010+
+  #010+
+  #010+
+  '# -------------'#010+
+  '# Linking'#010+
+  '# -------------'#010+
+  #010+
+  '# generate always debugging information for GDB (slows down the compil'+
+  'i','ng'#010+
+  '# process)'#010+
+  '#      -gc        generate checks for pointers'#010+
+  '#      -gd        use dbx'#010+
+  '#      -gg        use gsym'#010+
+  '#      -gh        use heap trace unit (for memory leak debugging)'#010+
+  '#      -gl        use line info unit to show more info for b','acktrace'+
+  's'#010+
+  '#      -gv        generates programs tracable with valgrind'#010+
+  '#      -gw        generate dwarf debugging info'#010+
+  '#'#010+
+  '# Enable debuginfo and use the line info unit by default'#010+
+  '#-gl'#010+
+  #010+
+  '# always pass an option to the linker'#010+
+  '#-k-s'#010+
+  #010+
+  '# Always str','ip debuginfo from the executable'#010+
+  '-Xs'#010+
+  #010+
+  #010+
+  '# -------------'#010+
+  '# Miscellaneous'#010+
+  '# -------------'#010+
+  #010+
+  '# Write always a nice FPC logo ;)'#010+
+  '-l'#010+
+  #010+
+  '# Verbosity'#010+
+  '#      e : Show errors (default)       d : Show debug info'#010+
+  '#      w : Show warnings               u : ','Show unit info'#010+
+  '#      n : Show notes                  t : Show tried/used files'#010+
+  '#      h : Show hints                  m : Show defined macros'#010+
+  '#      i : Show general info           p : Show compiled procedures'#010+
+  '#      l : Show linenumbers  ','          c : Show conditionals'#010+
   '#      a : Show everything             0 : Show nothing (except errors'+
-  ')'#013#010+
+  ')'#010+
   '#      b : Show all procedure          r : Rhide/GCC compatibility mod'+
-  'e'#013#010+
-  '#          declaration','s if an error    x : Executable info (Win32 on'+
-  'ly)'#013#010+
-  '#          occurs'#013#010+
-  '#'#013#010+
-  '# Display Info, Warnings, Notes and Hints'#013#010+
-  '-viwn'#013#010+
-  '# If you don'#039't want so much verbosity use'#013#010+
-  '#-vw'#013#010
+  'e'#010+
+  '#          declarations if an error    x : Executable info (Win3','2 on'+
+  'ly)'#010+
+  '#          occurs'#010+
+  '#'#010+
+  '# Display Info, Warnings, Notes and Hints'#010+
+  '-viwn'#010+
+  '# If you don'#039't want so much verbosity use'#010+
+  '#-vw'#010
 );

+ 59 - 79
utils/fpdoc/dw_html.pp

@@ -1193,103 +1193,83 @@ end;
 
 function THTMLWriter.AppendPasSHFragment(Parent: TDOMNode;
   const AText: String; AShFlags: Byte): Byte;
+  
+  
 var
-  CurParent: TDOMNode;
   Line, Last, p: PChar;
   IsInSpecial: Boolean;
+  lastwasasm : boolean;
   El: TDOMElement;
+
+  Procedure MaybeOutput;
+  
+  Var
+    CurParent: TDomNode;
+  
+  begin
+    If (Last<>Nil) then
+      begin
+      If (el<>Nil) then
+        CurParent:=El
+      else
+        CurParent:=Parent;  
+      AppendText(CurParent,Last);
+      El:=Nil;
+      Last:=Nil;
+      end;
+  end;
+
+  Function NewEl(Const ElType,Attr,AttrVal : String) : TDomElement; 
+  
+  begin
+    Result:=CreateEl(Parent,ElType);
+    Result[Attr]:=AttrVal;
+  end;
+  
+  Function NewSpan(Const AttrVal : String) : TDomElement; 
+  
+  begin
+    Result:=CreateEl(Parent,'span');
+    Result['class']:=AttrVal;
+  end;
+  
 begin
   GetMem(Line, Length(AText) * 3 + 4);
+  Try
   DoPascalHighlighting(AShFlags, PChar(AText), Line);
   Result := AShFlags;
-
-  CurParent := Parent;
   IsInSpecial := False;
-  Last := Line;
+  Last := Nil;
   p := Line;
+  el:=nil;
   while p[0] <> #0 do
   begin
     if p[0] = LF_ESCAPE then
-    begin
+      begin
       p[0] := #0;
-      AppendText(CurParent, Last);
-
-      if IsInSpecial then
-        CurParent := Parent;
+      MaybeOutput;
       case Ord(p[1]) of
-        shDefault:
-          IsInSpecial := False;
-        shInvalid:
-          begin
-            El := CreateEl(CurParent, 'font');
-            El['color'] := 'red';
-            CurParent := El;
-            IsInSpecial := True;
-          end;
-        shSymbol:
-          begin
-            El := CreateEl(CurParent, 'span');
-            El['class'] := 'sym';
-            CurParent := El;
-            IsInSpecial := True;
-          end;
-        shKeyword:
-          begin
-            El := CreateEl(CurParent, 'span');
-            El['class'] := 'kw';
-            CurParent := El;
-            IsInSpecial := True;
-          end;
-        shComment:
-          begin
-            El := CreateEl(CurParent, 'span');
-            El['class'] := 'cmt';
-            CurParent := El;
-            IsInSpecial := True;
-          end;
-        shDirective:
-          begin
-            El := CreateEl(CurParent, 'span');
-            El['class'] := 'dir';
-            CurParent := El;
-            IsInSpecial := True;
-          end;
-        shNumbers:
-          begin
-            El := CreateEl(CurParent, 'span');
-            El['class'] := 'num';
-            CurParent := El;
-            IsInSpecial := True;
-          end;
-        shCharacters:
-          begin
-            El := CreateEl(CurParent, 'span');
-            El['class'] := 'chr';
-            CurParent := El;
-            IsInSpecial := True;
-          end;
-        shStrings:
-          begin
-            El := CreateEl(CurParent, 'span');
-            El['class'] := 'str';
-            CurParent := El;
-            IsInSpecial := True;
-          end;
-        shAssembler:
-          begin
-            El := CreateEl(CurParent, 'span');
-            El['class'] := 'asm';
-            CurParent := El;
-            IsInSpecial := True;
-          end;
+        shDefault:    El:=Nil;
+        shInvalid:    El:=newel('font','color','red');
+        shSymbol :    El:=newspan('sym');
+        shKeyword:    El:=newspan('kw');
+        shComment:    El:=newspan('cmt');
+        shDirective:  El:=newspan('dir');
+        shNumbers:    El:=newspan('num');
+        shCharacters: El:=newspan('chr');
+        shStrings:    El:=newspan('str');
+        shAssembler:  El:=newspan('asm');
       end;
-      Last := p + 2;
-    end;
+      Inc(P);
+      end
+    else If (Last=Nil) then
+      Last:=P;
     Inc(p);
   end;
-  if Last <> p then
-    AppendText(CurParent, Last);
-  FreeMem(Line);
+  MaybeOutput;
+  Finally
+    FreeMem(Line);
+  end;
 end;
 
 Procedure THTMLWriter.AppendShortDescr(AContext: TPasElement; Parent: TDOMNode; DocNode : TDocNode);