# Copyright (c) 2005 - 2006 Hans Jeuken. All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # This file was generated from the 'html.xml' file of the syntax highlight # engine of the kate text editor (http://www.kate-editor.org #kate xml version 1.98 #kate version 2.4 #kate author Wilbert Berendsen (wilbert@kde.nl) #generated: Sun Feb 3 22:02:05 2008, localtime package Syntax::Highlight::Engine::Kate::HTML; use vars qw($VERSION); $VERSION = '0.03'; use strict; use warnings; use base('Syntax::Highlight::Engine::Kate::Template'); sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = $class->SUPER::new(@_); $self->attributes({ 'Attribute' => 'Others', 'CDATA' => 'BaseN', 'Comment' => 'Comment', 'Doctype' => 'DataType', 'Element' => 'Keyword', 'EntityRef' => 'DecVal', 'Error' => 'Error', 'Normal Text' => 'Normal', 'PEntityRef' => 'DecVal', 'Processing Instruction' => 'Keyword', 'Value' => 'String', }); $self->contextdata({ 'CDATA' => { callback => \&parseCDATA, attribute => 'Normal Text', }, 'CSS' => { callback => \&parseCSS, attribute => 'Normal Text', }, 'CSS content' => { callback => \&parseCSScontent, attribute => 'Normal Text', }, 'Comment' => { callback => \&parseComment, attribute => 'Comment', }, 'Doctype' => { callback => \&parseDoctype, attribute => 'Normal Text', }, 'Doctype Internal Subset' => { callback => \&parseDoctypeInternalSubset, attribute => 'Normal Text', }, 'Doctype Markupdecl' => { callback => \&parseDoctypeMarkupdecl, attribute => 'Normal Text', }, 'Doctype Markupdecl DQ' => { callback => \&parseDoctypeMarkupdeclDQ, attribute => 'Value', }, 'Doctype Markupdecl SQ' => { callback => \&parseDoctypeMarkupdeclSQ, attribute => 'Value', }, 'El Close' => { callback => \&parseElClose, attribute => 'Normal Text', }, 'El Close 2' => { callback => \&parseElClose2, attribute => 'Normal Text', }, 'El Close 3' => { callback => \&parseElClose3, attribute => 'Normal Text', }, 'El Open' => { callback => \&parseElOpen, attribute => 'Normal Text', }, 'FindAttributes' => { callback => \&parseFindAttributes, attribute => 'Normal Text', }, 'FindDTDRules' => { callback => \&parseFindDTDRules, attribute => 'Normal Text', }, 'FindEntityRefs' => { callback => \&parseFindEntityRefs, attribute => 'Normal Text', }, 'FindHTML' => { callback => \&parseFindHTML, attribute => 'Normal Text', }, 'FindPEntityRefs' => { callback => \&parseFindPEntityRefs, attribute => 'Normal Text', }, 'JS' => { callback => \&parseJS, attribute => 'Normal Text', }, 'JS comment close' => { callback => \&parseJScommentclose, attribute => 'Comment', lineending => '#pop', }, 'JS content' => { callback => \&parseJScontent, attribute => 'Normal Text', }, 'PI' => { callback => \&parsePI, attribute => 'Normal Text', }, 'Start' => { callback => \&parseStart, attribute => 'Normal Text', }, 'Value' => { callback => \&parseValue, attribute => 'Normal Text', fallthrough => 'Value NQ', }, 'Value DQ' => { callback => \&parseValueDQ, attribute => 'Value', }, 'Value NQ' => { callback => \&parseValueNQ, attribute => 'Normal Text', lineending => '#pop#pop', fallthrough => '#pop#pop', }, 'Value SQ' => { callback => \&parseValueSQ, attribute => 'Value', }, }); $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); $self->basecontext('Start'); $self->keywordscase(1); $self->initialize; bless ($self, $class); return $self; } sub language { return 'HTML'; } sub parseCDATA { my ($self, $text) = @_; # type => 'DetectSpaces' if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { return 1 } # type => 'DetectIdentifier' if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { return 1 } # String => ']]>' # attribute => 'CDATA' # context => '#pop' # endRegion => 'cdata' # type => 'StringDetect' if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#pop', 'CDATA')) { return 1 } # String => ']]>' # attribute => 'EntityRef' # context => '#stay' # type => 'StringDetect' if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) { return 1 } return 0; }; sub parseCSS { my ($self, $text) = @_; # attribute => 'Element' # char => '/' # char1 => '>' # context => '#pop' # endRegion => 'style' # type => 'Detect2Chars' if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { return 1 } # attribute => 'Element' # char => '>' # context => 'CSS content' # type => 'DetectChar' if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, 'CSS content', 'Element')) { return 1 } # context => 'FindAttributes' # type => 'IncludeRules' if ($self->includeRules('FindAttributes', $text)) { return 1 } # String => '\S' # attribute => 'Error' # context => '#stay' # type => 'RegExpr' if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { return 1 } return 0; }; sub parseCSScontent { my ($self, $text) = @_; # String => ' 'Element' # context => 'El Close 2' # endRegion => 'style' # insensitive => 'TRUE' # type => 'RegExpr' if ($self->testRegExpr($text, ' '##CSS' # includeAttrib => 'true' # type => 'IncludeRules' if ($self->includePlugin('CSS', $text)) { return 1 } return 0; }; sub parseComment { my ($self, $text) = @_; # type => 'DetectSpaces' if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { return 1 } # context => '##Alerts' # type => 'IncludeRules' if ($self->includePlugin('Alerts', $text)) { return 1 } # type => 'DetectIdentifier' if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { return 1 } # String => '-->' # attribute => 'Comment' # context => '#pop' # endRegion => 'comment' # type => 'StringDetect' if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#pop', 'Comment')) { return 1 } # String => '-(-(?!->))+' # attribute => 'Error' # context => '#stay' # type => 'RegExpr' if ($self->testRegExpr($text, '-(-(?!->))+', 0, 0, 0, undef, 0, '#stay', 'Error')) { return 1 } return 0; }; sub parseDoctype { my ($self, $text) = @_; # attribute => 'Doctype' # char => '>' # context => '#pop' # endRegion => 'doctype' # type => 'DetectChar' if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { return 1 } # attribute => 'Doctype' # beginRegion => 'int_subset' # char => '[' # context => 'Doctype Internal Subset' # type => 'DetectChar' if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'Doctype Internal Subset', 'Doctype')) { return 1 } return 0; }; sub parseDoctypeInternalSubset { my ($self, $text) = @_; # attribute => 'Doctype' # char => ']' # context => '#pop' # endRegion => 'int_subset' # type => 'DetectChar' if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { return 1 } # context => 'FindDTDRules' # type => 'IncludeRules' if ($self->includeRules('FindDTDRules', $text)) { return 1 } # String => '