Compil...:Token(3pm)

✨ NAME ✨

Compiler::Lexer::Token β€” it's the Token object for Compiler::Lexer, bestie πŸ’…

Like, one page in the Compil...:Token(3pm) manual, third section, User Contributed Perl Documentation vibes. Periodt.


🌸 SYNOPSIS 🌸

So Compiler::Lexer::Token includes the following members. That's it, that's the whole cast of characters πŸŽ€

  • stype β€” the constant of Compiler::Lexer::SyntaxType.
  • type β€” the constant of Compiler::Lexer::TokenType.
  • kind β€” the constant of Compiler::Lexer::Kind.
  • name β€” the name of Compiler::Lexer::TokenType.
  • data β€” the raw data, literally just the raw stuff, no filter.
  • has_warnings β€” a flag of whether it's an unknown keyword or not. Yep, it's the snitch flag πŸ™ˆ

πŸ’– METHODS πŸ’–

It supports simple get/set accessors like Class::Accessor::Fast. Very demure, very mindful, very get-and-set 🫢

example:

my $type = $token->type;                            # get accessor
$token->type(Compiler::Lexer::TokenType::T_RegExp); # set accessor

See? Call it with no args and it gets, call it with an arg and it sets. Main character energy, no cap ✨


πŸ‘‘ AUTHOR πŸ‘‘

Masaaki Goshima (goccy) <goccy(at)cpan.org>


Copyright (c) 2013, Masaaki Goshima (goccy). All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay that's the whole page bestie, go write some lexers πŸ’œ

perl v5.42.3 Β· 2026-08-19 Β· Compil...:Token(3pm) β€” mwah, thanks for reading, slay πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from