Syntax-Highlight-Engine-Kate
view release on metacpan or search on metacpan
lib/Syntax/Highlight/Engine/Kate/HTML.pm view on Meta::CPAN
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 => '</style\b'
# attribute => 'Element'
# context => 'El Close 2'
# endRegion => 'style'
# insensitive => 'TRUE'
# type => 'RegExpr'
if ($self->testRegExpr($text, '</style\\b', 1, 0, 0, undef, 0, 'El Close 2', 'Element')) {
return 1
}
# context => '##CSS'
# includeAttrib => 'true'
lib/Syntax/Highlight/Engine/Kate/HTML.pm view on Meta::CPAN
# char => '='
# context => 'Value'
# type => 'DetectChar'
if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, 'Value', 'Attribute')) {
return 1
}
return 0;
};
sub parseFindDTDRules {
my ($self, $text) = @_;
# String => '<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\b'
# attribute => 'Doctype'
# context => 'Doctype Markupdecl'
# type => 'RegExpr'
if ($self->testRegExpr($text, '<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\\b', 0, 0, 0, undef, 0, 'Doctype Markupdecl', 'Doctype')) {
return 1
}
return 0;
};
sub parseFindEntityRefs {
my ($self, $text) = @_;
# String => '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\w.:_-]*);'
# attribute => 'EntityRef'
# context => '#stay'
# type => 'RegExpr'
if ($self->testRegExpr($text, '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\\w.:_-]*);', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) {
return 1
}
# String => '&<'
# attribute => 'Error'
# context => '#stay'
# type => 'AnyChar'
if ($self->testAnyChar($text, '&<', 0, 0, undef, 0, '#stay', 'Error')) {
return 1
}
return 0;
};
sub parseFindHTML {
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 => 'Comment'
# beginRegion => 'comment'
# context => 'Comment'
# type => 'StringDetect'
if ($self->testStringDetect($text, '<!--', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
return 1
}
# String => '<![CDATA['
# attribute => 'CDATA'
# beginRegion => 'cdata'
# context => 'CDATA'
# type => 'StringDetect'
if ($self->testStringDetect($text, '<![CDATA[', 0, 0, 0, undef, 0, 'CDATA', 'CDATA')) {
return 1
}
# String => '<!DOCTYPE\s+'
# attribute => 'Doctype'
# beginRegion => 'doctype'
# context => 'Doctype'
# type => 'RegExpr'
if ($self->testRegExpr($text, '<!DOCTYPE\\s+', 0, 0, 0, undef, 0, 'Doctype', 'Doctype')) {
return 1
}
# String => '<\?[\w:-]*'
# attribute => 'Processing Instruction'
# beginRegion => 'pi'
# context => 'PI'
# type => 'RegExpr'
if ($self->testRegExpr($text, '<\\?[\\w:-]*', 0, 0, 0, undef, 0, 'PI', 'Processing Instruction')) {
return 1
}
# String => '<style\b'
# attribute => 'Element'
# beginRegion => 'style'
# context => 'CSS'
# insensitive => 'TRUE'
# type => 'RegExpr'
if ($self->testRegExpr($text, '<style\\b', 1, 0, 0, undef, 0, 'CSS', 'Element')) {
return 1
}
# String => '<script\b'
# attribute => 'Element'
# beginRegion => 'script'
# context => 'JS'
# insensitive => 'TRUE'
# type => 'RegExpr'
if ($self->testRegExpr($text, '<script\\b', 1, 0, 0, undef, 0, 'JS', 'Element')) {
return 1
}
# String => '<pre\b'
# attribute => 'Element'
# beginRegion => 'pre'
# context => 'El Open'
# insensitive => 'TRUE'
# type => 'RegExpr'
if ($self->testRegExpr($text, '<pre\\b', 1, 0, 0, undef, 0, 'El Open', 'Element')) {
return 1
}
# String => '<div\b'
# attribute => 'Element'
# beginRegion => 'div'
# context => 'El Open'
# insensitive => 'TRUE'
# type => 'RegExpr'
if ($self->testRegExpr($text, '<div\\b', 1, 0, 0, undef, 0, 'El Open', 'Element')) {
return 1
}
# String => '<table\b'
# attribute => 'Element'
# beginRegion => 'table'
( run in 1.861 second using v1.01-cache-2.11-cpan-e93a5daba3e )