PPIx::EditorTools::Lexer(3pm) User Contributed Perl Documentation PPIx::EditorTools::Lexer(3pm)NAME
PPIx::EditorTools::Lexer - Simple Lexer used for syntax highlighting
SYNOPSIS
PPIx::EditorTools::Lexer->new->lexer(
code => "package TestPackage;
sub x { 1;
",
highlighter => sub {
my ( $css, $row, $rowchar, $len ) = @_;
...
},
);
DESCRIPTION
Go over the various interesting elements of a give piece of code or an already process PPI tree. For each token call the user supplied
'highlighter' function with the follow values:
$css - The keyword that can be used for colouring.
$row - The row number where the token starts
$rowchar - The character within that row where the token starts
$len - The length of the token
METHODS
new()
Constructor. Generally shouldn't be called with any arguments.
find( ppi => PPI::Document $ppi, highlighter => sub {...} ) =item find( code => Str $code, highlighter => sub ...{} )
Accepts either a "PPI::Document" to process or a string containing the code (which will be converted into a "PPI::Document") to
process. Return a reference to an array.
SEE ALSO
This class inherits from "PPIx::EditorTools". Also see App::EditorTools, Padre, and PPI.
perl v5.14.2 2012-03-11 PPIx::EditorTools::Lexer(3pm)
Check Out this Related Man Page
PPIx::EditorTools::ReturnObject(3pm) User Contributed Perl Documentation PPIx::EditorTools::ReturnObject(3pm)NAME
PPIx::EditorTools::ReturnObject - Simple object to return values from PPIx::EditorTools
SYNOPSIS
my $brace = PPIx::EditorTools::FindUnmatchedBrace->new->find(
code => "package TestPackage;
sub x { 1;
"
);
my $location = $brace->element->location;
my $ppi = $brace->element->ppi;
DESCRIPTION
Retuning a simple "PPI::Element" from many of the "PPIx::EditorTools" methods often results in the loss of the overall context for that
element. "PPIx::EditorTools::ReturnObject" provides an object that can be passed around which retains the overall context.
For example, in "PPIx::EditorTools::FindUnmatchedBrace" if the unmatched brace were returned by its "PPI::Structure::Block" the containing
"PPI::Document" is likely to go out of scope, thus the "location" method no longer returns a valid location (rather it returns undef).
Using the "ReturnObject" preserves the "PPI::Document" and the containing context.
METHODS
new()
Constructor which should be used by "PPIx::EditorTools". Accepts the following named parameters:
ppi A "PPI::Document" representing the (possibly modified) code.
code
A string representing the (possibly modified) code.
element
A "PPI::Element" or a subclass thereof representing the interesting element.
ppi Accessor to retrieve the "PPI::Document". May create the "PPI::Document" from the $code string (lazily) if needed.
code
Accessor to retrieve the string representation of the code. May be retrieved from the "PPI::Document" via the serialize method (lazily)
if needed.
SEE ALSO
"PPIx::EditorTools", App::EditorTools, Padre, and PPI.
perl v5.14.2 2012-03-11 PPIx::EditorTools::ReturnObject(3pm)
I am trying to run the code below however I am getting a "syntax error near unexpected token `for file in error" on the line that is in red. I have the semicolons after every line because it will fail on the copy if I don't have them saying that it cannot stat directory. Is there something that I... (3 Replies)
Hi,
I'm using Linux through F-Secure. The VI editor I use doesnt support the syntax highlighter. Is there any way to invoke it?
Thanks in advance
Ananth (2 Replies)
Hi,
I need to find the "n/a" value presented row no. in my file i have following code but it gives all the row no. even i tried removing n/a by blank value and try to find the blank value it also failed.
awk -F\\t '{ if (NR == 1) { for (i=1;i<=NF;i++){if ($i==$3) { c=i } } };if (NR != 1) { if... (3 Replies)
Sooner than later I will render forum discussions in Vue.js to complement the standard way of showing forum threads.
Today, I ran across this component, vue-code-highlight
Beautiful code syntax highlighting as Vue.js component.
https://www.unix.com/members/1-albums225-picture1199.jpg
... (1 Reply)