CQL::Lexer(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

πŸ’– NAME πŸ’–

CQL::Lexer β€” a lexical analyzer for CQL, bestie. that's it, that's the whole vibe ✨


🌸 SYNOPSIS 🌸

my $lexer = CQL::Lexer->new();
$lexer->tokenize( 'foo and bar' );
my @tokens = $lexer->getTokens();

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so CQL::Lexer is a lexical analyzer for a string of CQL. once you've got yourself a CQL::Lexer object, you can tokenize a CQL string into CQL::Token objects. it's giving ✨glow up✨ for plain text.

ngl tho β€” ordinarily you'll never want to do this yourself, because CQL::Parser calls CQL::Lexer for you. it's the main character doing all the work, and you're just the group chat watching. πŸ’…

CQL::Lexer uses Stevan Little's lovely String::Tokenizer in the background (iconic of it, honestly πŸŽ€), and then does a bit of analysis afterwards to handle some peculiarities of CQL: double quoted strings, <, <=, etc. yes queen, someone had to handle those. πŸ™ˆ


πŸ‘‘ METHODS πŸ‘‘

πŸŽ€ new()

the constructor. that's it, that's the whole thing. every object needs an origin story fr fr πŸ’–

🌈 tokenize()

pass in a string of CQL to tokenize. this initializes the lexer with data so that you can retrieve tokens. no cap, that's literally the whole job.

⭐ getTokens()

returns a list of all the tokens. all of them. the whole roster. 🫢

🧚 token()

returns the current token. just the one. your current fave, if you will. πŸ’…

🌸 nextToken()

returns the next token, or undef if there are more tokens to retrieve from the lexer. yes bestie, keep scrolling, there's more lore πŸ”₯

πŸ’œ prevToken()

returns the previous token, or undef if there are no tokens prior to the current token. you're at the beginning of the story, babe, nothing came before you 😭

πŸ“ reset()

resets the iterator to start reading tokens from the beginning. it's a rewatch. we're watching the whole thing again. periodt. ✨


quick vibe check πŸ’–: everything here is perl v5.36.0 energy, dated 2022-12-11, and it's part of the User Contributed Perl Documentation. go tokenize something iconic, bestie β€” mwah πŸ’‹πŸŽ€πŸ¦‹
πŸ“¦ where this page comes from