NAME
Syntax::Highlight::Perl6 - Perl 6 syntax highlighter
SYNOPSIS
### NOTE: This is needed and will be removed in future releases
use STD;
use Syntax::Highlight::Perl6;
# Creates the Perl6 syntax highlighter object
my $p = Syntax::Highlight::Perl6->new(
text => 'my $foo;'
);
# Prints html that can be embedded in your pages
print $p->snippet_html;
# Prints html with css (useful for full pages)
print $p->simple_html;
# Prints html that has a JavaScript parse tree viewer
print $p->full_html;
# Prints ANSI escaped color sequences (useful for console and IRC output)
print $p->ansi_text;
# Prints the Perl 5 array of parse trees (useful for building stuff on top of it)
print $p->parse_trees;
DESCRIPTION
Highlights Perl 6 source code. The code is parsed using Larry Wall's STD.pm.
The available output formats are:
HTML (snippet,simple and full)
ANSI escaped color sequences
Perl 5 array of parse trees
METHODS
- new(options)
-
Returns the syntax highlighting object. It needs a hash of options.
- text
-
This is a required option. This is where you should provide the Perl 6 code.
- rule
-
parse rule name for STD.pm to parse against (default: comp_unit)
- clean_html
-
Flag to enable/disable CSS/JavaScript HTML inlining. (default: 1)
- file
-
file name string in HTML modes (default: a warning message)
- utf8_decode
-
Flag to enable/disable utf8 decoding. (default: 1)
- snippet_html
-
Returns the Perl 6 highlighted HTML string that can be embedded. No CSS or JavaScript is inside.
- simple_html
-
Returns the Perl 6 highlighted HTML string. The HTML is the same as
full_html
but lacks a JavaScript Parse Tree Viewer. - full_html
-
Returns the Perl 6 highlighted HTML string. The HTML consists of a JavaScript Parse Tree Viewer along with CSS-styling. It can inlined if
clean_html
option is 0. - ansi_text
-
Returns a Perl highlighted ANSI escape color string.
- parse_trees
-
Returns a Perl 5 array containing parse tree records. The array consists of one or more of the following record: ($position, $buffer, $rule_name, $parse_tree)
SEE ALSO
Discussion about this module is usually in #perl6 @ irc.freenode.net
AUTHOR
Ahmad Zawawi, <ahmad.zawawi@gmail.com>
Written by Ahmad M. Zawawi (azawawi), Moritz Lenz and Paweł Murias (pmurias)
The project idea was inspired by Moritz Lenz (moritz) See http://www.nntp.perl.org/group/perl.perl6.users/2008/07/msg788.html
The initial STD tree traversal code was written by Paweł Murias (pmurias).
A gimme5
-generated Perl5 STD.pmc
is included to parse Perl 6 code.
The redspans
traversal code was written by Larry Wall (TimToady).
redspans
stands for red
for reductions, and spans
from the from/to span calculations".
The javascript jQuery code was written by Ahmad M. Zawawi (azawawi)
COPYRIGHT AND LICENSE
Copyright (C) 2008 by Ahmad Zawawi
This library is free software; you can redistribute it and/or modify it under the same terms as the Artistic License 2.0
This library also includes the following libraries:
STD.pm by Larry Wall (Artistic License 2.0 - same license)
JQuery 1.2.6 by John Resig (dual licensed under the MIT and GPL licenses).
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 590:
Non-ASCII character seen before =encoding in 'Paweł'. Assuming UTF-8