This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
tokenizer-errors.h
58 lines (53 loc) · 2.21 KB
/
tokenizer-errors.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
#ifndef TOKENIZER_ERRORS_H
#define TOKENIZER_ERRORS_H
#include <stddef.h>
#include "tokens.h"
/*
Takes a pointer to an already allocated token t, a buffer, a starting
location, a maximum buffer size,
the line number of the buffer and the file of the buffer and produces an error
token for a general error.
Returns the number of characters consumed for the error, which is 0 if the
error token could not be
produced because a delimiter was not found in the given buffer size.
For a general error characters are consumed until any whitespace is seen.
*/
int generate_generic_error(Token** t,
char* buffer,
size_t start,
size_t size,
int line_num,
char* filename);
/*
Takes a pointer to an already allocated token t, a buffer, a starting
location, a maximum buffer size,
the line number of the buffer and the file of the buffer and produces an error
token for a general error.
Returns the number of characters consumed for the error, which is 0 if the
error token could not be
produced because a delimiter was not found in the given buffer size.
For a character error, characters are consumed until a ' or \n is seen.
*/
int generate_character_error(Token** t,
char* buffer,
size_t start,
size_t size,
int line_num,
char* filename);
/*
Takes a pointer to an already allocated token t, a buffer, a starting
location, a maximum buffer size,
the line number of the buffer and the file of the buffer and produces an error
token for a general error.
Returns the number of characters consumed for the error, which is 0 if the
error token could not be
produced because a delimiter was not found in the given buffer size.
For a string error, characters are consumed until a " or \n is seen.
*/
int generate_string_error(Token** t,
char* buffer,
size_t start,
size_t size,
int line_num,
char* filename);
#endif