Package minitex
Class MiniTexParser
java.lang.Object
minitex.MiniTexParser
This class provides a reader for a TeX
style configuration file.
The parser reads form the input reader and extracts macros invocations and environments on the top level. The following restrictions apply:
- Macros must have a single argument. An exception is the macro
\endinput
which terminates the reading immediately. - Environments may not have any argument. Arguments of environments are digested as part of their body.
- Comments are honored, i.e. discarded until end of line.
The arguments of macros and the body of environments are stored in map. The key is the name of the macro or environment. Macros and environments are treated identically. Thus the following instructions are the same:
\abc{123}and
\begin{abc}123\end{abc}
Macros and environments may contain TeX code. This is not interpreted. It is taken literally as the value. Nevertheless the blocks and environments need to be balanced.
The same macro and environment name can be used several timed. The values for the same key are stored in a list. The order of the elements in this list is the order in the input.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
MiniTexParser
This is the constructor forMiniTeXParser
.- Parameters:
reader
- the reader
-
-
Method Details
-
add
This method add a value to the definitions map.- Parameters:
key
- the keyvalue
- the value
-
parse
This method reads the input and stores the top-level macros and environments in a map.- Returns:
- the macros and environments found
- Throws:
IOException
- in case of an error
-