dlisp-0.3.2/parserreader.c File Reference

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_lispentrydlisp_read_lisp_bracket (FILE *f)
 Read inside bracket of lisp string.
dlisp_lispentrydlisp_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

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_lispentryalloc_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_lispentryread_lisp_entity (FILE *f)
 read a entity.

Detailed Description

reading routines for dancer's lisp parser library


Function Documentation

static dlisp_lispentry* alloc_lispentry ( FILE *  f  )  [static]
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.

Returns:
dlisp_lispentry
Parameters:
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.

Returns:
dlisp_lispentry structure filled with parsed lisp data.
Parameters:
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.

Parameters:
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

Parameters:
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]
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().


Generated on Fri Nov 6 00:31:46 2009 for dlisp API Reference by  doxygen 1.6.1