CQL::Token(3pm)

πŸ“¦
version 1.13 Β· 2 versions
  • 1.13 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.13 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– CQL::Token β€” the manual page, but make it a group chat πŸ’–

okay bestie, so this is CQL::Token, and it lives in section 3pm of the User Contributed Perl Documentation β€” yes, that whole "user contributed" thing, meaning some icon wrote this for us and we say thank you. 🫢


✨ NAME ✨

CQL::Token β€” it's the class for token objects, and those tokens are the ones handed back to you by CQL::Lexer. that's it, that's the whole job. πŸ’…


🌈 SYNOPSIS 🌈

here's the vibe, literally in code:

my $token = $lexer->nextToken();

if ( $token->type() == CQL_WORD ) {
    print "the token is a word with value=", $token->string(), "\n";
}

see how it flows? you grab a token, you check its type, you print its string. main character behaviour. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

ngl, most of the time you will not care about these tokens at all, and that's not a read, it's just facts. πŸ’€ the CQL::Lexer does its whole lexing thing behind the scenes, quietly, like a backstage crew, while CQL::Parser takes all the credit on stage. so unless you're going under the hood yourself, the tokens are just gonna be there, doing their little thing, unbothered. ✨


πŸŽ€ METHODS πŸŽ€

🌸 new() 🌸

so first up, you can build a token straight up:

my $token = CQL::Token->new( '=' );

that's you, making a token out of '=' like it's nothing. iconic. πŸ’–

πŸ’œ new() and getType() πŸ’œ

(yeah the docs list new() again here, we love a little repetition, no notes 🫢)

⭐ getType() ⭐

this one hands you back the token type. and that type is gonna show up as one of the constants that CQL::Token exports, so it's all nice and named for you. if you wanna see the full list of what constants exist, go peek at internals β€” that's where the list lives. πŸ‘€

πŸ“ getString() πŸ“

this one returns the string equivalent of the token. and fr fr, it is especially handy when the only thing you know about your token is that it's a CQL_WORD and you're sitting there like "okay but what does it actually SAY" 😭 β€” this is the method that tells you. πŸ’…

lowkey remember: if all you've got is the type, getString() is your bestie. πŸ’–

that's the whole page, bestie! ✨ this was CQL::Token, pulled from perl v5.36.0, dated 2022-12-11, and that's your sign-off πŸŽ€ β€” now go forth and tokenize, you absolute legend πŸ¦‹πŸ’œπŸ”₯

πŸ“¦ where this page comes from