pt::util(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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 (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