Code Pastie ID: 1256 (Edit or View CSS/HTML)
While Not(Source.IsEOS) Do
Begin
  If Source.TkType = ccHTMLParser_BGTag Then
  Begin
    Source.Skip;
    If Source.TkType = ccHTMLParser_Slash Then
    Begin
      If Source.TkType = ccHTMLParser_Ident Then
        If Source.Token = Finishing Then
        Begin
          Source.Skip;
          If Source.TkType <> ccHTMLParser_EDTag Then
            Raise EHTMLLoader.Create('Expected > at ' + IntToStr(Source.Row) + ',' 
              + IntToStr(Source.Col));
          Exit;
        End
        Else
          Raise EHTMLLoader.Create(Source.Token + 'cannot end ' + Finishing 
            + ' sequence of childs at ' + IntToStr(Source.Row) + ',' 
            + IntToStr(Source.Col))
      Else
        Raise EHTMLLoader.Create('Expected tag name at ' + IntToStr(Source.Row) 
          + ',' + IntToStr(Source.Col));
    End
    Else
      Previous.AppendChild(ParseTag)
  Else
    Previous.AppendChild(THTMLText.Create(Source.Token));
End;