1PPIx::EditorTools::LexeUrs(e3r)Contributed Perl DocumentPaPtIixo:n:EditorTools::Lexer(3)
2
3
4
6 PPIx::EditorTools::Lexer - Simple Lexer used for syntax highlighting
7
9 version 0.21
10
12 PPIx::EditorTools::Lexer->new->lexer(
13 code => "package TestPackage;\nsub x { 1;\n",
14 highlighter => sub {
15 my ( $css, $row, $rowchar, $len ) = @_;
16 ...
17 },
18 );
19
21 Go over the various interesting elements of a give piece of code or an
22 already process PPI tree. For each token call the user supplied
23 'highlighter' function with the follow values:
24
25 $css - The keyword that can be used for colouring.
26 $row - The row number where the token starts
27 $rowchar - The character within that row where the token starts
28 $len - The length of the token
29
31 new()
32 Constructor. Generally shouldn't be called with any arguments.
33
34 find( ppi => PPI::Document $ppi, highlighter => sub {...} )
35 find( code => Str $code, highlighter => sub ...{} )
36 Accepts either a "PPI::Document" to process or a string containing
37 the code (which will be converted into a "PPI::Document") to
38 process. Return a reference to an array.
39
41 This class inherits from "PPIx::EditorTools". Also see
42 App::EditorTools, Padre, and PPI.
43
45 • Steffen Mueller "smueller@cpan.org"
46
47 • Mark Grimes "mgrimes@cpan.org"
48
49 • Ahmad M. Zawawi <ahmad.zawawi@gmail.com>
50
51 • Gabor Szabo <gabor@szabgab.com>
52
53 • Yanick Champoux <yanick@cpan.org>
54
56 This software is copyright (c) 2017, 2014, 2012 by The Padre
57 development team as listed in Padre.pm..
58
59 This is free software; you can redistribute it and/or modify it under
60 the same terms as the Perl 5 programming language system itself.
61
62
63
64perl v5.34.0 2022-01-21 PPIx::EditorTools::Lexer(3)