#include #include #include "../tokenizer.h" int main() { char *stream = "identifier (arg1, arg2, ...) => do: while:;;"; SwToken *token; SwTokenBuffer *buffer; printf("\n\nTesting Swerve tokenizer...\n"); printf("---------------\n"); printf("buffer to parse: %s\n\n", stream); printf("symbol\t\tvalue\n"); printf("------\t\t-----\n"); buffer = init_tokenizer(stream); while((token = next_token(buffer)) != NULL) { printf("%d\t\t%s\n", token->symbol, (token->value == NULL ? "" : token->value)); } disable_tokenizer(buffer); return 0; } /* output: Testing Swerve tokenizer... --------------- buffer to parse: identifier (arg1, arg2, ...) => do: while:;; symbol value ------ ----- 9 identifier 43 9 arg1 9 arg2 23 44 8 9 do 9 while 18 18 */