- NAME
- SYNOPSIS
- DESCRIPTION
- SEE ALSO
- COPYRIGHT

# NAME

ActiveState::Tkx::TextSyntaxTags - perform syntax coloring of text wigets

# SYNOPSIS

      use ActiveState::Tkx::TextSyntaxTags qw(update_syntax_tags);
      my $text = $mw->new_text;
      $text->insert("end", file_content($file));
      update_syntax_tags($text, lang => "perl");

# DESCRIPTION

The `ActiveState::Tkx::TextSyntaxTags` module provide a single function:

update_syntax_tags( $text_w, %options )

  This will assign tags to ranges of the text widget that correspond to syntax elements.

  file => $filename

    Tell update_syntax_tags() which file is displayed in the text widget. If not provided all text in the widget is assumed to be code (unless the 'range' option is provided).

  lang => $lang

    The programming language displayed. The $lang argument can be one of 'perl', 'python', 'ruby', 'vbscript', or 'xslt'. The default is 'perl'. Passed on to `ActiveState::Scineplex`.

  linemap => \%linemap
  linemap => \&linemap

    The optional `linemap` argument can be used to specify where the source lines from the file specified with the 'file' argument is located in the text widget. If not provided it is assumed that the content of the text widget match the source text exactly; this is same as `linemap => sub { "$_[0].0" }` .

    The `linemap` maps from a line number (1 based) to a position (index) into the text widget of the standard "line.char" form. If the linemap return a false value then no syntax tagging is performed for the given line.

  range => [$first, $last]
  range => "$first-$last"

    Add syntax color to the given line range within the text widget. The line number range can either be passed as a 2 element array reference or as a string with the line numbers separated by "-".

    This option can't be combined with the 'file' and 'linemap' options.

# SEE ALSO

ActiveState::Scineplex

# COPYRIGHT

Copyright (C) 2010 ActiveState Software Inc. All rights reserved.