TeX/include/TeX/parser.h

45 lines
1.4 KiB
C

//---
// parser: interface to the TeX parser
//---
#ifndef TEX_PARSER
#define TEX_PARSER
#include <TeX/TeX.h>
#include <TeX/structure.h>
/* parse_start(): Configure parser to run on a string
@str Input data, must be NULL-terminated */
void parse_start(const char *str);
/* parse(): Parse into a TeX flow
Uses input data set by parse_start(). Returns a flow object on success (free
with TeX_free()), NULL on error (generally syntax issues).
TODO: Fine-grained error detection? */
struct TeX_Flow *parse(void);
#ifdef TEX_DEBUG
/* TeX_debug_lex(): Display the result of lexing
Makes a lexical analysis of the given formula and prints the stream of
tokens to standard output. */
void TeX_debug_lex(const char *formula);
/* TeX_debug_node(): Recursively display the structure of a node
Displays the nature and dimensions of the given node and its children,
making recursive calls to TeX_debug_flow().
@node Displayed node
@indent Indent level, in spaces (goes up by groups of 4) */
void TeX_debug_node(struct TeX_Node *node, int indent);
/* TeX_debug_flow(): Recursively display the structure of a flow
Displays the dimensions of the given flow and its contents, making recursive
calls to TeX_debug_node().
@flow Displayed flow
@indent Indent level, in spaces (goes up by groups of 4) */
void TeX_debug_flow(struct TeX_Flow *flow, int indent);
#endif /* TEX_DEBUG */
#endif /* TEX_PARSER */