CTAN Comprehensive TeX Archive Network

Directory macros/generic/tokstools

README.md

tokstools - A / set of tools for manipulating tokens

Notice

This package is still in the experimental stage. Therefore, its behavior is not guaranteed to match the description in the manual, and bugs of varying severity may occur.

Additionally, some features, as well as their syntax, may be subject to change.

It requires any modern engine that supports etex primitives and can therefore be used with either or .

Description

The tokstools package provides tools for manipulating tokens and implements “PEG”-style grammars in . Predefined elementary patterns can be combined to form grammars that search for matches within tokens.

Two categories of macros are provided:

  • those operating on individual tokens (\toksdo, \tokscount, and \printtoks)
  • those operating on tokens that have matched a grammar (\ifpegmatch, \pegcount, and \pegreplace)

These matches can be counted, captured, modified, or replaced.

License

Released under the Project Public License v1.3c or later. See https://www.latex-project.org/lppl.txt

Download the contents of this package in one zip archive (487.2k).

tokstools – Tools for manipulating tokens

This package for or provides tools for manipulating tokens. Within a set of tokens, it is possible to define matching rules using PEG-type grammars. It then becomes possible to test whether a match exists, to count matches, to perform replacements, to capture tokens, and more.

Packagetokstools
Version0.1
LicensesThe Project Public License 1.3c
Copyright2026 Christian Tellechea
MaintainerChristian Tellechea
TopicsGeneric Macros
Macro Demonstration
...
Guest Book Sitemap Contact Contact Author