NAME

Syntax::Highlight::Engine::Kate::Template - a template for syntax highlighting plugins

DESCRIPTION

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 $cap in 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 $mode is specified, $string should only be one character long and numeric. capturedParse will return the Nth captured element of the current context.

If $mode is not specified, all occurences 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. $item can be callback, attribute, lineending, linebeginning, fallthrough.

contextParse($plugin, $context);

Called by the plugins after a test succeeds. if $context has following values:

#pop       returns to the previous context, removes to top item in the stack. Can
           also 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 $string is also a spatial character.

formatTable

sets and returns the instance variable format_table. See also the option format_table

highlight($text);

highlights $text. It does so by selecting the proper callback from the commands hash and invoke it. It will do so untill $text has 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_table and substitutions

includePlugin($language, \$text);

Includes the plugin for $language in the highlighting.

includeRules($language, \$text);

Includes the plugin for $language in 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 $column is a defined numerical value it will test if the process is at the requested column. If $firnonspace is true, it will test this also. Ig it is not a look ahead and all tests are passed, $match is 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

SEE ALSO

Synax::Highlight::Engine::Kate http:://www.kate-editor.org

1 POD Error

The following errors were encountered while parsing the POD:

Around line 917:

=cut found outside a pod block. Skipping to next block.