parse.cpp File Reference

#include "parse.hpp"

Functions

bool iswhitespace (char ch)
 Check whether the character is whitespace.
void readsinglesymbol (string &substring, string &sexpr)
void clearwhitespace (string &sexpr)
 Clear the whitespace at the begining and end of string sexpr.
Cellmakecell (string str)
 Make the cell.
Cellseparate_parse (string &instr)
 Separately parse the sexpr and build the tree.
Cellparse (string sexpr)
 Recursively parse sexpr and build the parse tree.

Detailed Description

Implementation of a parser that analyzes a string containing an s-expression, and determines its tree structure.

Function Documentation

void clearwhitespace string &  sexpr  ) 
 

Clear the whitespace at the begining and end of string sexpr.

Parameters:
sexpr The string.

bool iswhitespace char  ch  ) 
 

Check whether the character is whitespace.

Returns:
True if it is character, false else.
Parameters:
ch The character to check.

Cell* makecell string  str  ) 
 

Make the cell.

Parameters:
str The string to represent the symbol, int or double.

Cell* parse string  sexpr  ) 
 

Recursively parse sexpr and build the parse tree.

Parameters:
sexpr The s-expression stored in a string variable (note that this version of parse has side effects: it may alter the contents of sexpr).
Returns:
A pointer to the conspair cell at the root of the parse tree.

void readsinglesymbol string &  substring,
string &  sexpr
 

Cell * separate_parse string &  instr  ) 
 

Separately parse the sexpr and build the tree.

Parameters:
instr The string which consists of s-expressions.
Returns:
A pointer to the conspair cell at the root of the parse tree.


Generated on Fri Apr 21 18:12:52 2006 for a1 by  doxygen 1.4.6