Syntax::Highlight::Engine::Kate::Template3pm
A template for syntax highlighting plugins
Overview
Syntax::Highlight::Engine::Kate::Template is a framework to assist authors of plugin modules. All methods to provide highlighting to the Syntax::Highlight::Engine::Kate module are there, Just no syntax definitions and callbacks. An instance of Syntax::Highlight::Engine::Kate::Template should never be created, it's meant to be sub classed only.
Methods
attributes(?$attributesref?);-
Sets and returns a reference to the attributes hash.
basecontext(?$context?);-
Sets and returns the basecontext instance variable. This is the context that is used when highlighting starts.
captured($cap);-
Puts
$capin the first element of the stack, the current context. Used when the context is dynamic.
capturedGet($num);-
Returns the
$num'th element that was captured in the current context.
capturedParse($string, $mode);-
If
$modeis specified,$stringshould only be one character long and numeric.capturedParsewill return the Nth captured element of the current context.If
$modeis not specified, all occurrences of %[1-9] will be replaced by the captured element of the current context.
column-
returns the column position in the line that is currently highlighted.
contextdata(\%data);-
Sets and returns a reference to the contextdata hash.
contextInfo($context, $item);-
returns the value of several context options.
$itemcan becallback,attribute,lineending,linebeginning,fallthrough.
contextParse($plugin, $context);-
Called by the plugins after a test succeeds. if
$contexthas following values:#pop returns to the previous context, removes to top item in the stack. Canalso be specified as #pop#pop etc.#stay does nothing.##.... Switches to the plugin specified in .... and assumes it's basecontext..... Swtiches to the context specified in ....
deliminators(?$delim?);-
Sets and returns a string that is a regular expression for detecting deliminators.
engine-
Returns a reference to the Syntax::Highlight::Engine::Kate module that created this plugin.
firstnonspace($string);-
returns true if the current line did not contain a non-spatial character so far and the first character in
$stringis also a spatial character.
formatTable-
sets and returns the instance variable
format_table. See also the optionformat_table
highlight($text);-
highlights $text. It does so by selecting the proper callback from the
commandshash and invoke it. It will do so until$texthas been reduced to an empty string. returns a paired list of snippets of text and the attribute with which they should be highlighted.
highlightText($text);-
highlights $text and reformats it using the
format_tableandsubstitutions
includePlugin($language, \$text);-
Includes the plugin for
$languagein the highlighting.
includeRules($language, \$text);-
Includes the plugin for
$languagein the highlighting.
keywordscase-
Sets and returns the keywordscase instance variable.
lastchar-
return the last character that was processed.
lastcharDeliminator-
returns true if the last character processed was a deliminator.
linesegment-
returns the string of text in the current line that has been processed so far,
linestart-
returns true if processing is currently at the beginning of a line.
listAdd('listname', $item1, $item2 ...);-
Adds a list to the 'lists' hash.
lists(?\%lists?);-
sets and returns the instance variable 'lists'.
out(?\@highlightedlist?);-
sets and returns the instance variable 'out'.
parseResult(\$text, $match, $lookahaed, $column, $firstnonspace, $context, $attribute);-
Called by every one of the test methods below. If the test matches, it will do a couple of subtests. If
$columnis a defined numerical value it will test if the process is at the requested column. If$firnonspaceis true, it will test this also. Ig it is not a look ahead and all tests are passed,$matchis then parsed and removed from$$text.
pluginGet($language);-
Returns a reference to a plugin object for the specified language. Creating an instance if needed.
reset-
Resets the highlight engine to a fresh state, does not change the syntx.
snippet-
Contains the current snippet of text that will have one attribute. The moment the attribute changes it will be parsed.
snippetAppend($string)-
appends $string to the current snippet.
snippetAttribute($attribute)-
Sets and returns the used attribute.
snippetForce-
Forces the current snippet to be parsed.
snippetParse($text, ?$attribute?)-
If attribute is defined and differs from the current attribute it does a snippetForce and sets the current attribute to
$attribute. Then it does a snippetAppend of$text
stack-
sets and returns the instance variable 'stack', a reference to an array
stackPull-
retrieves the element that is on top of the stack, decrements stacksize by 1.
stackPush($tagname);-
puts $tagname on top of the stack, increments stacksize by 1
stackTop-
Retrieves the element that is on top of the stack.
stateCompare(\@state)-
Compares two lists, \@state and the stack. returns true if they match.
stateGet-
Returns a list containing the entire stack.
stateSet(@list)-
Accepts @list as the current stack.
substitutions-
sets and returns a reference to the substitutions hash.
The methods below all return a boolean value.
testAnyChar(\$text, $string, $insensitive, $lookahaed, $column, $firstnonspace, $context, $attribute);
testDetectChar(\$text, $char, $insensitive, $dynamic, $lookahaed, $column, $firstnonspace, $context, $attribute);
testDetect2Chars(\$text, $char1, $char2, $insensitive, $dynamic, $lookahaed, $column, $firstnonspace, $context, $attribute);
testDetectIdentifier(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);
testDetectSpaces(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);
testFloat(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);
testHlCChar(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);
testHlCHex(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);
testHlCOct(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);
testHlCStringChar(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);
testInt(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);
testKeyword(\$text, $list, $insensitive, $lookahaed, $column, $firstnonspace, $context, $attribute);
testLineContinue(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);
testRangeDetect(\$text, $char1, $char2, $insensitive, $lookahaed, $column, $firstnonspace, $context, $attribute);
testRegExpr(\$text, $reg, $insensitive, $dynamic, $lookahaed, $column, $firstnonspace, $context, $attribute);
testStringDetect(\$text, $string, $insensitive, $dynamic, I$lookahaed, $column, $firstnonspace, $context, $attribute);
Acknowledgements
All the people who wrote Kate and the syntax highlight xml files.
Author and copyright
This module is written and maintained by:
Hans Jeuken < haje at toneel dot demon dot nl >
Copyright (c) 2006 by Hans Jeuken, all rights reserved.
You may freely distribute and/or modify this module under same terms as Perl itself
Releases
8 releases since Debian 6.0 (Squeeze); the text changed 4 times.