#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "dlispparser.h"
Internal static functions used inside parser reader | |
This section describes function that are used only inside the parser system. | |
static void | lisp_error (FILE *f, const char *sentence) |
generate an error, and exit. | |
static void | skip_to_newline (FILE *f) |
skip up to the next newline | |
static int | peek_char_raw (FILE *f) |
peek one character, only for read_noncomment_char | |
static void | skip_to_comment_terminator (FILE *f) |
Multi-line comment procedure. | |
static int | read_noncomment_char (FILE *f) |
read a new character, excluding comments. | |
static int | peek_char (FILE *f) |
peek one character, taking comments in consideration. | |
static int | force_read_char (FILE *f, int want_char, const char *accept_char) |
Force-read char, and give error. | |
static void | skip_spaces (FILE *f) |
skip space, ignoring comments. | |
static dlisp_lispentry * | alloc_lispentry (FILE *f) |
allocate lisp entry structure. | |
static char * | read_lisp_name (FILE *f, const char *terminatorstring) |
read lisp symbol, delimited by terminatorstring. | |
static dlisp_lispentry * | read_lisp_entity (FILE *f) |
read a entity. | |
Functions | |
dlisp_lispentry * | dlisp_read_lisp_bracket (FILE *f) |
Read inside bracket of lisp string. | |
dlisp_lispentry * | dlisp_read_lisp_text (FILE *f) |
read a string of lisp text, with many brackets, and create a tree representation of it. |
static dlisp_lispentry* alloc_lispentry | ( | FILE * | f | ) | [static] |
allocate lisp entry structure.
dlisp_lispentry* dlisp_read_lisp_bracket | ( | FILE * | f | ) |
Read inside bracket of lisp string.
Read from a file stream, and return a dlisp_lispentry structure parsing the lisp construct.
f | Input file stream |
dlisp_lispentry* dlisp_read_lisp_text | ( | FILE * | f | ) |
read a string of lisp text, with many brackets, and create a tree representation of it.
f | Input file stream |
static int force_read_char | ( | FILE * | f, | |
int | want_char, | |||
const char * | accept_char | |||
) | [static] |
Force-read char, and give error.
accept_char | can be null |
static void lisp_error | ( | FILE * | f, | |
const char * | sentence | |||
) | [static] |
generate an error, and exit.
Noting the current character position
f | input file stream |
sentence | error message |
static int peek_char | ( | FILE * | f | ) | [static] |
peek one character, taking comments in consideration.
static int peek_char_raw | ( | FILE * | f | ) | [static] |
peek one character, only for read_noncomment_char
static dlisp_lispentry* read_lisp_entity | ( | FILE * | f | ) | [static] |
read a entity.
entity -> lisp-bracket | term lisp-bracket -> (entity*)
static char* read_lisp_name | ( | FILE * | f, | |
const char * | terminatorstring | |||
) | [static] |
read lisp symbol, delimited by terminatorstring.
escape is done with "\"
current buffer position
previous char, used for checking \
static int read_noncomment_char | ( | FILE * | f | ) | [static] |
read a new character, excluding comments.
static void skip_spaces | ( | FILE * | f | ) | [static] |
skip space, ignoring comments.
static void skip_to_comment_terminator | ( | FILE * | f | ) | [static] |
Multi-line comment procedure.
skip to !#
static void skip_to_newline | ( | FILE * | f | ) | [static] |
skip up to the next newline