PPIx::...:Lexer(3pm)

πŸ“¦
version 0.21 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute

🌸 NAME 🌸

PPIx::EditorTools::Lexer β€” a lil simple lexer that does syntax highlighting, and she ate πŸ’…

This is a Perl manual page (the 3pm kind, bestie, library docs, you know the vibe) πŸ’–


✨ VERSION ✨

version 0.21 πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

PPIx::EditorTools::Lexer->new->lexer(
      code => "package TestPackage;\nsub x { 1;\n",
      highlighter => sub {
              my ( $css, $row, $rowchar, $len ) = @_;
              ...
      },
    );

πŸ’– DESCRIPTION πŸ’–

okay so basically? she goes over all the interesting elements of a given piece of code β€” or of a PPI tree you already processed β€” and for every single token she calls the highlighter function you supplied 🫢

And here's what she hands to that function, every time:

$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

no cap, that's the whole gig 🌈


🧚 METHODS 🧚

new()

Constructor πŸŽ€ Generally shouldn't be called with any arguments. Like, it can be, but bestie… don't πŸ™ˆ

find( ppi => PPI::Document $ppi, highlighter => sub {...} )

find( code => Str $code, highlighter => sub ...{} )

She accepts either a PPI::Document to process, or a string containing the code (which gets converted into a PPI::Document first, obviously) to process πŸ’…

Returns a reference to an array. periodt. ✨


πŸ‘‘ SEE ALSO πŸ‘‘

This class inherits from PPIx::EditorTools. Also go look at App::EditorTools, Padre, and PPI πŸ’œ


🌟 AUTHORS 🌟

  • Steffen Mueller "smueller@cpan.org" πŸ“
  • Mark Grimes "mgrimes@cpan.org" πŸ“
  • Ahmad M. Zawawi <ahmad.zawawi@gmail.com> πŸ“
  • Gabor Szabo <gabor@szabgab.com> πŸ“
  • Yanick Champoux <yanick@cpan.org> πŸ“

the whole squad fr fr 🫢


This software is copyright (c) 2017, 2014, 2012 by The Padre development team as listed in Padre.pm. πŸ’–

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. πŸ”₯

slay, that means you can remix it, just keep the same terms, iykyk πŸ’…

that's the whole page, bestie β€” no notes, you got this πŸ’–βœ¨

perl v5.34.0, dated 2022-06-17 β€” and yes the manual name is that cursed PPIx::...:Lexer(3pm) thing, that's just how she's filed, don't ask 🫢🌈⭐

πŸ“¦ where this page comes from