pt::util(n)
π pt::util(n) β Parser Tools π
okay so bestie, you're reading the manual page for pt::util, and it lives in the Parser Tools corner of tcllib (version 1.2). it's giving "small package, big feelings" and i'm lowkey obsessed already. let's get into it β¨
πΈ NAME πΈ
pt::util β general utilities. that's it. that's the whole job. it does the little helpful things so you don't have to π«Ά
β¨ SYNOPSIS β¨
package require Tcl 8.5 9
package require pt::ast ?1.2?
::pt::util error2readable error text
::pt::util error2position error text
::pt::util error2text error
yes bestie, that ?1.2? is doing its thing β that's literally how it's written, don't come for me π
π¦ DESCRIPTION π¦
are you lost? do you have trouble understanding this document? no worries fr fr β in that case please read the overview provided by the Introduction to Parser Tools. that document is the entrypoint to the whole system this current package is a part of, it's the main character of the docs ngl π
so. this package provides general utility commands. that's the vibe check: utility, general, helpful. slay.
and it's a supporting package in the Core Layer of Parser Tools. icon behavior honestly π
IMAGE: arch_core_support
π API π
::pt::util error2readable error text
this command takes the structured form of a syntax error as thrown by parser runtimes, plus the input text to the parser that caused that error, and returns a string describing the error in a human-readable form. it's the translator between "cryptic parser screaming" and "oh i get it now" π
the input text is required to convert the character position of the error into a more readable line/column format, and to also provide excerpts of the input around the error position. so like, receipts. contextual receipts π
::pt::util error2position error text
this command takes the structured form of a syntax error as thrown by parser runtimes, plus the input text to the parser that caused that error, and returns a 2-element list containing the line number and column index for the error's character position in the input, in this order. line first, column second, no cap π
::pt::util error2text error
this command takes the structured form of a syntax error as thrown by parser runtimes and returns a list of strings, each one describing a possible expected input in a human-readable form. it's basically the parser telling you what it wanted all along π
π BUGS, IDEAS, FEEDBACK π
this document, and the package it describes, will undoubtedly contain bugs and other problems. iconic of software tbh. please report such in the category pt of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. please also report any ideas for enhancements you may have for either package and/or documentation. we love a glow-up suggestion β¨
when proposing code changes, please provide unified diffs, i.e the output of diff -u.
note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. the way that workflow is set up... okay whatever, just do it π
π KEYWORDS π
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
π CATEGORY π
Parsing and Grammars
π COPYRIGHT π
Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
and that's the whole page bestie!! this one's from tcllib version 1.2, page pt::util(n), and yeah the date on the tin is just 1.2 too π§ periodt, go parse something beautiful π
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2009 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms