---
name: "Tk::CodeText::Template"
section: "3pm"
platform: "linux"
package: "libtk-codetext-perl"
version: "0.3.4-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Tk::CodeText::Template"
---

# Tk::CodeText::Template(3pm)

a template for syntax highlighting plugins

## NAME

Tk::CodeText::Template - a template for syntax highlighting plugins

## SYNOPSIS

## DESCRIPTION

Tk::CodeText::Template is a framework to assist authors of plugin modules. All methods to provide highlighting in a Tk::CodeText widget are there, Just no syntax definitions and callbacks. An instance of Tk::CodeText::Template  should never be created, it's meant to be sub classed only.

## METHODS

- **callbacks**({*'Tagname'* =\> *\\&callback*, ...});

  sets and returns the instance variable 'callbacks'

- **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.

- **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'.

- **parserError**(*'text'*);

  Error trapping method. Tries to escape the current mode. If that is not possible, it will parse the text with the default tag. Furthermore it complains about being called at all. Usefull for debugging when writing a new plugin.

- **rules**(*?\\@rules?*)

  sets and returns a reference to a list of tagnames and options. By default it is set to \[\].

- **snippetAppend**(*$string*)

  appends *$string* to the current snippet.

- **snippetParse**(*?$text?*, *?$tagname?*)

  parses `$text` to the 'out' list, and assigns `$tagname` to it. If `$tagname` is not specified it will look for the tagname by calling **stackTop**. If *$text* is also not specified it will look for text by calling **snippet**.

- **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.

- **tokenParse**(*'Tagname'*);

  Parses the currently build snippet and tags it with 'Tagname'

- **tokenTest**(*$value*, *'Listname'*);

  returns true if `$value` is and element of 'Listname' in the 'lists' hash

## AUTHOR

Hans Jeuken (haje@toneel.demon.nl)

## BUGS

Unknown.
