Package minitex

Class InsAnalyzer

java.lang.Object
minitex.InsAnalyzer

public class InsAnalyzer extends Object
This class contains a parser to analyse .ins (installer) files as used by the CTAN/LaTeX packaging tools.

An .ins file is a small TeX-like script which, among other things, declares which files a package generates or ships. This parser does not attempt to interpret the full TeX macro language; instead it recognizes a small, fixed set of macros (\file and \generateFile) that name output files, skips TeX comments introduced by %, and silently ignores everything else (including grouping braces { and }, and unrecognized macros).

  • Constructor Details

    • InsAnalyzer

      public InsAnalyzer()
      Creates a new InsParser and registers the built-in macros \file and \generateFile. Both macros expect a single braced argument, e.g. \file{name.sty}, and record dir concatenated with the braced content as a file name in the resulting list; they are treated identically since, for the purposes of this parser, both simply declare a produced file.
  • Method Details

    • parse

      public List<String> parse(String dir, Reader reader) throws IOException
      Parses the contents of an .ins file, collecting the names of all files declared via the \file and \generateFile macros.

      The given reader is read to its end (or until an error occurs) and is closed by this method before returning, even if an exception is thrown while parsing.

      Parameters:
      dir - the directory to prepend to each declared file name; use the empty string to obtain file names exactly as they appear in the input
      reader - the reader providing the contents of the .ins file; it is closed by this method
      Returns:
      the list of file names declared in the input, in the order in which they were encountered
      Throws:
      IOException - in case of an I/O error, or if the input is malformed (e.g. an unterminated macro argument)