/* readone - attempt to read a single expression */ int readone(LVAL fptr, LVAL *pval) { LVAL val,type; int ch; /* get a character and check for EOF */ if ((ch = xlgetc(fptr)) == EOF) return (EOF); /* handle white space */ if ((type = tentry(ch)) == k_wspace) return (FALSE); /* handle symbol constituents */ else if (type == k_const) { xlungetc(fptr,ch); *pval = psymbol(fptr); return (TRUE); } /* handle single and multiple escapes */ else if (type == k_sescape || type == k_mescape) { xlungetc(fptr,ch); *pval = psymbol(fptr); return (TRUE); } /* handle read macros */ else if (consp(type)) { if ((val = callmacro(fptr,ch)) && consp(val)) { *pval = car(val); return (TRUE); } else return (FALSE); } /* handle illegal characters */ else xlerror("illegal character",cvfixnum((FIXTYPE)ch)); }
vector<psymbol> production_reader::space_splitted(string str){ stringstream ss(str); vector<psymbol> tokens; while(ss){ string t; ss >> t; if(t.size()){ tokens.push_back(psymbol(t,get_psymbol_type(t))); } } return tokens; }
void printsymboltable(){ node p; pput("Symbol Table\n"); for (p = complete_symbol_list; p != NULL; p = CDR(p)) psymbol(CAR(p)); pput("\n"); }