Jim Turner > Tk-TextHighlight-1.0.5 > Tk::TextHighlight::Perl

Download:
Tk-TextHighlight-1.0.5.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.4   Source  

NAME ^

Tk::TextHighlight::Perl - a Plugin for Perl syntax highlighting

SYNOPSIS ^

Tk::TextHighlight::Kate inherits Syntax::Highlight::Engine::Kate;

  use Tk;
  require Tk::TextHighlight;

  my $m = new MainWindow;

  my $e = $m->Scrolled("TextHighlight",
    -syntax => "Kate::Perl",     #SPECIFY "Kate::" AND THE LANGUAGE OF CHOICE.
    -scrollbars => "se",
    -background => "black",
  )->pack(-expand => 1, -fill => "both");

  #OPTIONALLY ADD KATE'S LANGUAGE LIST TO THE "Syntax.View" RIGHT-BUTTON MENU:

  my ($sections, $extensions) = $e->fetchKateInfo;
  $e->addKate2ViewMenu($sections);

  $m->MainLoop;

For its limitations see also there. This module provides extra methods to provide syntax highlighting for the Perl programming language.

METHODS ^

highlight($string);

returns a list of string snippets and tags that can be inserted in a Tk::Text like widget instantly.

rules($txtwidget,\@list)

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

 [
   ['Alert', -foreground => 'blue'],
   ['BaseN', -foreground => '#007f00'],
   ['BString', -foreground => '#c9a7ff'],
   ['Char', -foreground => 'green'],
   ['Comment', -foreground => 'lightblue'],
   ['DataType', -foreground => 'blue'],
   ['DecVal', -foreground => 'yellow'],
   ['Error', -foreground => '#ff0000'],
   ['Float', -foreground => 'yellow'],
   ['Function', -foreground => 'darkred'],
   ['IString', -foreground => 'yellow'],
   ['Keyword', -foreground => 'darkgreen'],
   ['Normal', -foreground => 'black'],
   ['Operator', -foreground => 'black'],   #NEEDS 2B SAME AS NORMAL SO " -opt => 'str'" looks right!
   ['Others', -foreground => '#b03060'],
   ['RegionMarker', -foreground => '#96b9ff'],
   ['Reserved', -foreground => 'darkred'],
   ['String', -foreground => 'green'],
   ['Variable', -foreground => 'blue'],
   ['Warning', -foreground => 'yellow'],
 ]
rulesConfigure($txtwidget,\@list)

Used internally. Don't call it yourself.

rulesDelete($txtwidget,\@list)
stateCompare(\@state);

Compares @state to the current state of the formatter. returns true when equal.

stateGet

Returns a list of the current state of the formatter. Called by the highlighting routines in Tk::TextHighlight.

stateSet(@list)

Sets the state of the formatter. Called by the highlighting routines in Tk::TextHighlight.

AUTHOR ^

Original CodeText Author: Hans Jeuken (haje@toneel.demon.nl)

TextHighlight Author: Jim Turner (turnerjw784@mesh.net)

BUGS ^

Probably plenty

syntax highlighting: