tokentable.C
inter/tokentable.C · 3.4 KB
From the archive interlude_1beta5.tar.gz
Download the archive « Back to the archive contents
#include "Structures.h"
#include "tokentable.h"
#pragma implementation
#define ALL_ARGS 666
const struct ttstruct tokentable[] = {
{"", 0 , 0 , 0},
{"=", 2 , 2 , 2},
{"<", 2 , 2 , 2},
{">", 2 , 2 , 2},
{"%", ALL_ARGS , 2 , ALL_ARGS},
{"/", ALL_ARGS , 2 , ALL_ARGS},
{"-", ALL_ARGS , 2 , ALL_ARGS},
{"+", ALL_ARGS , 2 , ALL_ARGS},
{"*", ALL_ARGS , 2 , ALL_ARGS},
{"set", 0 , 2 , ALL_ARGS},
{"not", 1 , 1 , 1},
{"or", 1 , 1 , ALL_ARGS}, /** short-circuiting **/
{"and", 1 , 1 , ALL_ARGS}, /** short-circuiting **/
{"index", 2 , 2 , 2},
{"range", 3 , 3 , 3},
{"tonum", 1 , 1 , 1},
{"toreal", 1 , 1 , 1},
{"tostr", 1 , 1 , 1},
{"toobj", 1 , 1 , 1},
{"time", 0 , 0 , 0},
{"random", 0 , 0 , 0},
{"length", 1 , 1 , 1},
{"insert", 3 , 3 , 3},
{"crypt", 1 , 1 , 1},
{"if", 1 , 2 , 3},
{"dotimes", 0 , 2 , 2},
{"foreach", 0 , 2 , 2},
{"while", 1 , 2 , 2},
{"pass", ALL_ARGS , 0 , ALL_ARGS},
{"pass-to", ALL_ARGS , 1 , ALL_ARGS},
{"sleep", 1 , 1 , 1},
{"fork", 0 , 1 , ALL_ARGS},
{"kill", 0 , 0 , 0},
{"echo", 1 , 1 , 1},
{"setparents", 2 , 2 , 2}, /** #0-only **/
{"var", 0 , 2 , ALL_ARGS},
{"rmvar", 1 , 1 , 1},
{"addcmd", 2 , 2 , 2},
{"rmcmd", 1 , 1 , 1},
{"matchcmd", 1 , 1 , 1},
{"call", 1 , 2 , ALL_ARGS},
{"method", 0 , 0 , 0}, /** this will never be used **/
{"commands", 0 , 0 , 0},
{"vars", 0 , 0 , 0},
{"clone", 0 , 0 , 0},
{"disconnect", 0 , 0 , 0},
{"reconnect", 2 , 2 , 2}, /** #0-only **/
{"shutdown", 0 , 0 , 0}, /** #0-only **/
{"return", 1 , 1 , 1}, /** returns from closest enclosing method **/
{"begin", ALL_ARGS , 1 , ALL_ARGS},
{"raise", ALL_ARGS , 1 , 2},
{"tolist", ALL_ARGS , 0 , ALL_ARGS},
{"ignore", 1 , 2 , 2},
{"compile", 1 , 1 , 1},
{"search", 2 , 2 , 2},
{"parents", 0 , 0 , 0},
{"explode", 2 , 2 , 2},
{"purge-cmds", 0 , 0 , 0},
{"car", ALL_ARGS, 1, 1},
{"cdr", ALL_ARGS, 1, 1},
{"cons", ALL_ARGS, 2, 2},
{"tosym", ALL_ARGS, 1, 1},
{"after", 2 , 2 , 2},
{"before", 2 , 2 , 2},
{"quote", 0 , 1 , 1},
{"eval", 1 , 1 , 2},
{"typeof", 1 , 1 , 1},
{"filetext", 1 , 1 , 1},
{"run-script", ALL_ARGS , 1 , 2},
{"class", 2 , 2 , 2},
{"square-root",1 , 1 , 1},
{"reg-split", 2 , 2 , 2},
{"connect-out",2 , 2 , 2},
{"handle", 3 , 3 , 3},
{"semaphore", 0 , 2 , ALL_ARGS},
{"address", 0 , 0 , 0},
{">=", 2 , 2 , 2},
{"<=", 2 , 2 , 2},
{"format", 2 , 2 , 2},
{"implode", 2 , 2 , 2},
{"sets", 2 , 2 , ALL_ARGS},
{"num2char", 1 , 1 , 1},
{"char2num", 1 , 1 , 1},
{"collect", 1 , 1 , 1},
{"match-one", 2 , 2 , 2},
{"log", 1 , 1 , 1}
};
char* type_strings[] = {
"UNUSED",
"STRING",
"NUMBER",
"OBJECT",
"ERROR",
"LIST",
"REAL",
"METHOD",
"EXPRESSION",
"SYMBOL",
"RESERVED",
"SUBRANGE",
"USER-DEFINED"
};
StringValHash* init_token_table(void){
int i;
StringValHash* retval = new StringValHash;
for (i=0 ; i < (sizeof(tokentable) / sizeof(tokentable[0])) ; i++)
retval->add (new Value (i, RESERVED),
new String (tokentable[i].symbol));
return retval;
}