-
Notifications
You must be signed in to change notification settings - Fork 0
/
tokenlist.h
73 lines (60 loc) · 1.45 KB
/
tokenlist.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef TOKEN_LIST
#define TOKEN_LIST
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "config.h"
typedef struct token_list {
char *token; /* Command, operation or operand */
struct token_list *next; /* List pointer */
} token_list;
char std_peek(void);
/*
* @function Peek next character in stdin
* @return Next character in stdin
*/
char *ch2str(char c);
/*
* @function Makes string out of char
* @param c - character to make string
* @return string consisting of one charachter
*/
char *get_word_std(void);
/*
* @function Get characters before next space, new line or end of file
* @return word from stdin
*/
int iscmd(char c);
/*
* @function Checks if symbol is command symbol
* @param c - character to check
* @return 1 - is command symbol, 0 - not
*/
token_list *new_token(char *token);
/*
* @function Creates new token with value (token, NULL)
* @param *token - string to put in token
* @return new token pointer
*/
void push_token(token_list **t, char *token);
/*
* @function Add new token to list
* @param **t - token list
* @param *token - token to put
*/
void print_token_list(token_list *t);
/*
* @function Prints list to stdout
* @param **t - token list
*/
void clear_token_list(token_list *t);
/*
* @function Frees memory
* @param **t - token list
*/
token_list *get_token_list(void);
/*
* @function Gets token list from stdin
* @return token list from stdin
*/
#endif // TOKEN_LIST