Skip to main content

Module pkgmeta

Module pkgmeta 

Source
Expand description

Static recognition of the package/class authoring commands — the metadata a .sty/.cls declares about itself. Definitions are inspected, not executed.

Three declarations are extracted, mirroring how \definecolor/\newglossaryentry feed the SemanticModel:

  • \ProvidesPackage/\ProvidesClass/\ProvidesFile and the expl3 \ProvidesExplPackage/Class/File — the package/class identity (name, date, version, description) → ProvidesDecl.
  • \NeedsTeXFormat — the required format and optional release date → NeedsFormatDecl.
  • \DeclareOption (and the starred default handler \DeclareOption*) — a declared option name → OptionDecl.

\ProcessOptions/\ExecuteOptions carry no extractable identity, so they get no model entry — the LSP hover renders a static note for them.

Extraction populates SemanticModel during its CST walk. Consumers match declarations by their control-word range.

Structs§

NeedsFormatDecl
A \NeedsTeXFormat{format}[date] declaration.
OptionDecl
A \DeclareOption{name}{code} declaration, or the starred default handler \DeclareOption*{code} (with name None).
ProvidesDecl
A \ProvidesPackage/Class/File (or its expl3 variant) self-identification.

Enums§

ProvidesForm
The argument shape of a \Provides… declaration: the LaTeX2e {name}[info] or the expl3 {name}{date}{version}{description}.
ProvidesKind
Which of the three \Provides… namespaces a declaration names.

Functions§

needs_format_from_command
Extract a NeedsFormatDecl from a \NeedsTeXFormat COMMAND node.
option_from_command
Extract an OptionDecl from a \DeclareOption COMMAND node. The non-star form \DeclareOption{name}{code} reads the name from group 0; the starred default handler \DeclareOption*{code} (recognized by the * WORD the parser folds into the invocation) records name: None.
provides_from_command
Extract a ProvidesDecl from a \Provides… COMMAND node, or None if the name group is a non-literal (nested macro) or the command is not a \Provides….
provides_kind
Whether name is a \Provides… declaration, and which namespace it names.