pt::util(3tcl)
β¨ pt::util β bestie edition β¨
okay so this is the pt::util page from the Parser Tools manual, and honestly? it's a little one but it's so useful. come sit with me π
πΈ NAME πΈ
pt::util β General utilities β¨
π 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
π DESCRIPTION π
Are you lost ? Do you have trouble understanding this document ? bestie, if that's you, pls go read the overview in the Introduction to Parser Tools. that doc is literally the entrypoint to the whole system this package is part of, no cap π«Ά
so, what is this? this package provides general utility commands. that's it, that's the job. it's giving helper-energy πββοΈ
and for the record: this is a supporting package in the Core Layer of Parser Tools. iykyk π
IMAGE: arch_core_support πΌοΈ
π₯ API π₯
::pt::util error2readable error text
this one takes the structured form of a syntax error β yk, the kind parser runtimes throw β plus the input text you fed to the parser that caused said error, and hands you back a string describing the error in a human-readable form β¨
the input text is required here, babe. why? because it needs it to convert the character position of the error into a way more readable line/column format, and also to give you excerpts of the input around where the error happened. so it can point at the crime scene π΅οΈββοΈ
::pt::util error2position error text
same deal β takes the structured form of a syntax error as thrown by parser runtimes, plus the input text to the parser that caused that error. but this one returns a 2-element list containing the line number and the column index for the error's character position in the input β in that order, bestie, order matters π
::pt::util error2text error
takes the structured form of a syntax error as thrown by parser runtimes and returns a list of strings, where each string describes a possible expected input in a human-readable form. it's basically the parser telling you "girl, i was expecting one of these" π
π BUGS, IDEAS, FEEDBACK π
ngl, this document β and the package it describes β will undoubtedly contain bugs and other problems. like, obviously. so pls report them in the category pt of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. and while you're there, also report any ideas for enhancements you may have for either the package and/or the documentation. we love ideas π«Ά
when you're proposing code changes, pls provide unified diffs, i.e the output of diff -u. this is not optional-vibes, this is the format π«
also note: attachments are strongly preferred over inlined patches. you can attach stuff 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. yes, that specific button. go find 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>
okay that's the whole page, bestie, we ate and left no crumbs π this was the pt::util page from tcllib, version 1.2, dated... well, that footer spot in the tcllib manual, section 3tcl πΈ mwah, go forth and parse responsibly π§ββοΈπ
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- 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