reading routines for dancer's lisp parser library More...
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <ctype.h>#include "dlispparser.h"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. | |
Internal static functions used inside parser reader | |
| 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. | |
reading routines for dancer's lisp parser library
| static dlisp_lispentry* alloc_lispentry | ( | FILE * | f | ) | [static] |
allocate lisp entry structure.
References dlisp_lispentry::child, dlisp_lispentry::dlisp_error, lisp_error(), dlisp_lispentry::name, dlisp_lispentry::next, and dlisp_lispentry::type.
Referenced by read_lisp_entity().
| 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 |
References force_read_char(), dlisp_lispentry::next, peek_char(), read_lisp_entity(), and skip_spaces().
Referenced by read_lisp_entity().
| 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 |
References lisp_error(), dlisp_lispentry::next, peek_char(), read_lisp_entity(), and skip_spaces().
Referenced by main().
| 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 |
References lisp_error(), and read_noncomment_char().
Referenced by dlisp_read_lisp_bracket(), and read_lisp_entity().
| 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 |
Referenced by alloc_lispentry(), dlisp_read_lisp_text(), force_read_char(), and read_lisp_entity().
| static int peek_char | ( | FILE * | f | ) | [static] |
peek one character, taking comments in consideration.
References read_noncomment_char().
Referenced by dlisp_read_lisp_bracket(), dlisp_read_lisp_text(), read_lisp_entity(), and read_lisp_name().
| static int peek_char_raw | ( | FILE * | f | ) | [static] |
peek one character, only for read_noncomment_char
Referenced by read_noncomment_char(), and skip_to_comment_terminator().
| static dlisp_lispentry* read_lisp_entity | ( | FILE * | f | ) | [static] |
read a entity.
entity -> lisp-bracket | term lisp-bracket -> (entity*)
References alloc_lispentry(), dlisp_lispentry::child, dlisp_lispentry::dlisp_bracket, dlisp_lispentry::dlisp_cdata, dlisp_lispentry::dlisp_comma, dlisp_lispentry::dlisp_commaat, dlisp_lispentry::dlisp_quasiquote, dlisp_lispentry::dlisp_quotedtext, dlisp_read_lisp_bracket(), dlisp_lispentry::dlisp_sharp_vector_constant, dlisp_lispentry::dlisp_stringconstant, force_read_char(), lisp_error(), dlisp_lispentry::name, peek_char(), read_lisp_name(), and dlisp_lispentry::type.
Referenced by dlisp_read_lisp_bracket(), and dlisp_read_lisp_text().
| 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 \
References peek_char(), and read_noncomment_char().
Referenced by read_lisp_entity().
| static int read_noncomment_char | ( | FILE * | f | ) | [static] |
read a new character, excluding comments.
References peek_char_raw(), skip_to_comment_terminator(), and skip_to_newline().
Referenced by force_read_char(), peek_char(), read_lisp_name(), and skip_spaces().
| static void skip_spaces | ( | FILE * | f | ) | [static] |
skip space, ignoring comments.
References read_noncomment_char().
Referenced by dlisp_read_lisp_bracket(), and dlisp_read_lisp_text().
| static void skip_to_comment_terminator | ( | FILE * | f | ) | [static] |
Multi-line comment procedure.
skip to !#
References peek_char_raw().
Referenced by read_noncomment_char().
| static void skip_to_newline | ( | FILE * | f | ) | [static] |
skip up to the next newline
Referenced by read_noncomment_char().
1.6.1