Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Main module for parsing string to an AST representing LaTeX Books
type cmd =
| NullCommand
A nullcommand is nothing
*)| AtomCmd of string * string list
An atomic command just have a name and eventual parameters like \newline
*)| SimpleCmd of string * string list * string
A command with extactly one argument e.g. \chaptername
| MultipleCmd of string * string list * string list
A command with multiple arguments e.g. \fracx
Commande type : an internal used in the first phase of the parsing
type structure =
| Nul
| Line of string
A line of just plain text like "It's the Enterprise!"
*)| Cmd of cmd
A command of our internal type used in the parsing
*)| AtomicCmd of string * string list
The final type to represent an atomic command like \newline
*)| OneArgCmd of string * string list * structure list
Structure version of SimpleCdm
*)| MultipleArgCmd of string * string list * structure list list
Structure version of MultipleCmd
*)| Env of string * structure list
An environment like document,center,equation...
*)| Math of string
A re-latexified math literal to be sent to an online image processing
*)| Subsubsection of string * structure list
Represent the LaTeX subsubsection, a subsubsection have a name and a list of structure children
*)| Subsection of string * structure list
See above
*)| Section of string * structure list
See above
*)| Chapter of string * structure list
See above
*)Structure used to represent in an AST-ish (just one node with a list of structure children) LaTeX
val preamble : (string, string) Hashtbl.t
Parses an accolade for the first time (command reading)
Parses arguments of a function colorlinks,12pt
to a list of string "colorlinks","12pt"
val parse_command : char list -> cmd * char list
Parses a command recursively, called when a \ is detected in the parsing of a string
Appends a line to a list if the line is not empty
val parse_math : char list -> structure * char list
Parses inline $$ math
Parses recursively a string into a list of structure, transforms commands to their final type
Take the list of structure and gives the preamble (everything before the start of the document) and the document itself
Recursively generates the environments (begin...end) statements
val read_preamble : structure list -> unit
Reads the preamble for type,title,author and eventual glossary input