00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <stdio.h>
00026 #include <stdlib.h>
00027
00028 #include "token.h"
00029 #include "input.h"
00030
00031 Token token;
00032
00038 int tokenInit(void) {
00039 token.next = NULL;
00040 token.type = 0;
00041 return 0;
00042 }
00043
00050 int tokenClose(void) {
00051
00052 return 0;
00053 }
00054
00055 int tokenize(void) {
00056 Token *curTok;
00057 printf("\n+ tokenize()\n");
00058 while(tokenGet(curTok) == 0) {
00059 printf("Token (%c)\n", curTok->name[0]);
00060 if(curTok->name[0] == 'Q') break;
00061 tokenDelete(curTok);
00062 }
00063 printf("- tokenize()\n");
00064 return 0;
00065 }
00066
00067 int tokenGet(Token *tok) {
00068 char c;
00069
00070
00071 tokenNew(tok);
00072 if(inputChar(&c)) {
00073 tok->name[0] = c;
00074 tok->name[1] = '\n';
00075
00076 } else return 1;
00077 printf("- getToken()\n");
00078 return 0;
00079 }
00080
00081 int tokenNew(Token *newTok) {
00082 newTok = malloc(sizeof(Token));
00083 return 0;
00084 }
00085
00086 int tokenDelete(Token *delTok) {
00087 printf("+ delTok()\n");
00088 free(&delTok);
00089 printf("- delTok()\n");
00090 return 0;
00091 }
00092
00093