blob: bd96b8e8b2ce6c5339cc025604cfbe025f58d419 (
plain)
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
|
/*
* blogc: A blog compiler.
* Copyright (C) 2015 Rafael G. Martins <rafael@rafaelmartins.eng.br>
*
* This program can be distributed under the terms of the BSD License.
* See the file COPYING.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include "utils/utils.h"
#include "output.h"
void
blogc_parser_syntax_error(const char *name, const char *src, size_t src_len,
size_t current)
{
b_string_t *msg = b_string_new();
while (current < src_len) {
char c = src[current];
if (c == '\r' || c == '\n')
break;
b_string_append_c(msg, c);
current++;
}
fprintf(stderr, "%s parser error: syntax error near \"%s\"\n", name,
msg->str);
b_string_free(msg, true);
}
|