14 RParser::RParser(Reader *r)
20 // returns the name of the relation whose range is defined
21 char* RParser::parserelation()
23 Token token = reader->peakahead();
25 while(token.token_type==TOKEN_EOL)
28 token = reader->peakahead();
31 if (token.token_type==TOKEN_EOF)
35 needtoken(TOKEN_COLON); // we need a colon
37 char* relation = new char[strlen(token.str)+1];
38 strcpy(relation, token.str);
44 WorkSet* RParser::parseworkset()
46 #ifdef DEBUGMANYMESSAGES
47 printf("Parsing a new workset... \n");
50 WorkSet *wset = new WorkSet(true);
51 needtoken(TOKEN_OPENBRACE); // need an open brace
53 Token token = reader->readnext();
55 while (token.token_type != TOKEN_CLOSEBRACE)
58 //printf("Adding %s...\n", token.str);
61 char* newtoken = (char*) malloc(strlen(token.str));
62 strcpy(newtoken, token.str);
64 wset->addobject(newtoken);
66 token = reader->readnext();
68 if (token.token_type == TOKEN_COMMA)
69 token = reader->readnext();
85 void RParser::skiptoken()
91 void RParser::needtoken(int token)
93 Token t=reader->readnext();
94 if (!(t.token_type==token))
96 printf("Needed token: ");
98 printf("\n Got token: %s ",t.str);
99 tokenname(t.token_type);