Syntax-Highlight-Engine-Kate
view release on metacpan or search on metacpan
lib/Syntax/Highlight/Engine/Kate/XML.pm view on Meta::CPAN
callback => \&parseStart,
attribute => 'Normal Text',
},
'Value' => {
callback => \&parseValue,
attribute => 'Normal Text',
},
'Value DQ' => {
callback => \&parseValueDQ,
attribute => 'Value',
},
'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 'XML';
}
sub parseAttribute {
my ($self, $text) = @_;
# attribute => 'Attribute'
# char => '='
# context => 'Value'
# type => 'DetectChar'
if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, 'Value', 'Attribute')) {
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 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 parseComment {
my ($self, $text) = @_;
# type => 'DetectSpaces'
if ($self->testDetectSpaces($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
}
# context => '##Alerts'
# type => 'IncludeRules'
if ($self->includePlugin('Alerts', $text)) {
return 1
}
# type => 'DetectIdentifier'
if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
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 => '['
lib/Syntax/Highlight/Engine/Kate/XML.pm view on Meta::CPAN
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 parseFindPEntityRefs {
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 => '%[A-Za-z_:][\w.:_-]*;'
# attribute => 'PEntityRef'
# context => '#stay'
# type => 'RegExpr'
if ($self->testRegExpr($text, '%[A-Za-z_:][\\w.:_-]*;', 0, 0, 0, undef, 0, '#stay', 'PEntityRef')) {
return 1
}
# String => '&%'
# attribute => 'Error'
# context => '#stay'
# type => 'AnyChar'
if ($self->testAnyChar($text, '&%', 0, 0, undef, 0, '#stay', 'Error')) {
return 1
}
return 0;
};
sub parseFindXML {
my ($self, $text) = @_;
# type => 'DetectSpaces'
if ($self->testDetectSpaces($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 => '<[A-Za-z_:][\w.:_-]*'
# attribute => 'Element'
# beginRegion => 'element'
# context => 'Element'
# type => 'RegExpr'
if ($self->testRegExpr($text, '<[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, 'Element', 'Element')) {
return 1
}
# context => 'FindEntityRefs'
# type => 'IncludeRules'
if ($self->includeRules('FindEntityRefs', $text)) {
return 1
}
# type => 'DetectIdentifier'
if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
return 1
}
return 0;
};
sub parsePI {
my ($self, $text) = @_;
# attribute => 'Processing Instruction'
# char => '?'
# char1 => '>'
# context => '#pop'
# endRegion => 'pi'
# type => 'Detect2Chars'
if ($self->testDetect2Chars($text, '?', '>', 0, 0, 0, undef, 0, '#pop', 'Processing Instruction')) {
return 1
}
return 0;
};
sub parseStart {
my ($self, $text) = @_;
# context => 'FindXML'
# type => 'IncludeRules'
if ($self->includeRules('FindXML', $text)) {
( run in 0.564 second using v1.01-cache-2.11-cpan-63c85eba8c4 )