void init_rep_parser(file_name)

- initialize this module String file_name;

This module contains the functions used in parsing the replacement file. The function init_rep_parser() initializes this module and reads the replacement file from file file_name. All information about the replacements is stored in the Parserinfo structure (see tags.c). The syntax of the replacement file is checked and some error recovery is performed. Checks are made whether elements and their associated attributes exist.

String rep_location()

- give the location in the replacement file

void debug_rep_parser(b)

- set debugging flag to b Bool b;

The function rep_location() returns the location in the replacement file. This is used by report.c, to give the correct line location in error messages.

int get_char()

- return next character of replacement file

void unget_char(ch)

- pushback one character of replacement file int ch;

The function get_char() reads from the fysical replacement file. unget_char() puts ch back on the replacement file.

int get_octal()

- read an octal number

void get_name(name, max_length)

- read a name char* name; int max_length;

These functions read an octal number or a name from the replacement file, using get_char() and unget_char().

void unget_token()

- pushback one token

void insert_token(token, value)

- insert a token int token; int value;

unget_token() puts the last token back, so it will be returned again. The function insert_token() inserts token with value value on the input stream. This is used for error-recovery.

int get_rule_token()

- get next token in rule-mode

int get_fmt_token()

- get next token in format-mode

void skip_line()

- skip current line

int skip_layout()

- skip layout and return next token in rule-mode

int get_token()

- return next token

These functions read tokens and/or skip layout. skip_line() is used to skip a comment line.

void assert_char(ch)

- read next character and assert it equals ch int ch;

void assert_token(token)

- read next token and assert it equals token int token;

Some simple assertions. If an assertion does not match, an error is reported and the character or token is inserted.

Bool read_plus()

- read a PLUS token

void read_chars(s, max_length)

- read a string of datacharacters String s; int max_length;

void read_delete(token)

- read a string of datacharacters, which is deleted int token;

P_Group read_formats(tag, elem_name, attlist)

- read a format int tag; String elem_name; P_Attdeflist attlist;

void read_tago(tag)

- read a start- or end-tag replacement int tag;

void read_file()

- read the replacement file

These function constitute the recursive descent parser that parses the replacement file. See also the technical documentation on the backend for the syntax of the replacement file.

rep_pars.c rep_pars.h