-
Notifications
You must be signed in to change notification settings - Fork 0
/
tokens.h
36 lines (29 loc) · 996 Bytes
/
tokens.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef GG_120_TOKENS
#define GG_120_TOKENS
#include <stdlib.h>
#include <stdio.h>
#include "120++defs.h"
typedef struct token
{
char *filename; /* the source file in which the token occurs */
int lineno; /* the line number on which the token occurs */
int category; /* the integer code returned by yylex */
char *text; /* the actual string (lexeme) matched */
int ival; /* if you had an integer constant, store its value here */
double rval; /* if you had a float constant, store its value here */
char *sval; /* if you had a string constant, malloc space and store */
/* the string (less quotes and after escapes) here */
} token;
typedef struct t_node
{
token *t;
struct t_node *next;
} t_node;
void tl_init(t_node **head);
int tl_is_empty(t_node *head);
int tl_size(t_node *head);
token* tl_insert(t_node **head);
t_node* tl_end(t_node *head);
void tl_print(t_node *head);
void tl_destruct(t_node **head);
#endif /* GG_120_TOKENS */