Parse compound statements, 'break', 'continue', 'default', 'case' and
[smatch.git] / test-lexing.c
blobd4638bbfa61b8e3eb6caeb32c226aa5876cfc14c
1 #include <stdarg.h>
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <ctype.h>
6 #include <unistd.h>
7 #include <fcntl.h>
9 #include "token.h"
11 int main(int argc, char **argv)
13 int fd = open(argv[1], O_RDONLY);
14 struct token *token;
16 if (fd < 0)
17 die("No such file: %s", argv[1]);
19 token = tokenize(argv[1], fd);
20 while (token) {
21 struct token *next = token->next;
22 char separator = '\n';
23 if (next && next->line == token->line)
24 separator = ' ';
25 printf("%s%c", show_token(token), separator);
26 token = next;
28 putchar('\n');
29 show_identifier_stats();
30 return 0;