CQL::Token(3pm)
π 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
- debian bookworm: libcql-parser-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcql-parser-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcql-parser-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcql-parser-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcql-parser-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms