2012-09-11 12:24:54 +01:00
|
|
|
#ifndef _LOCFILE_H
|
|
|
|
#define _LOCFILE_H
|
2013-05-26 12:42:04 +10:00
|
|
|
|
2013-11-30 02:05:42 -06:00
|
|
|
#include "jq.h"
|
|
|
|
|
2012-09-11 00:04:47 +01:00
|
|
|
typedef struct {
|
|
|
|
int start, end;
|
|
|
|
} location;
|
|
|
|
|
2012-09-11 12:24:54 +01:00
|
|
|
static const location UNKNOWN_LOCATION = {-1, -1};
|
|
|
|
|
2012-09-11 00:04:47 +01:00
|
|
|
struct locfile {
|
|
|
|
const char* data;
|
|
|
|
int length;
|
|
|
|
int* linemap;
|
|
|
|
int nlines;
|
2013-11-30 02:05:42 -06:00
|
|
|
char *error;
|
|
|
|
jq_state *jq;
|
2012-09-11 00:04:47 +01:00
|
|
|
};
|
|
|
|
|
2013-11-30 02:05:42 -06:00
|
|
|
void locfile_init(struct locfile* l, jq_state *jq, const char* data, int length);
|
2012-09-11 00:04:47 +01:00
|
|
|
|
2013-05-26 12:42:04 +10:00
|
|
|
void locfile_free(struct locfile* l);
|
2012-09-11 00:04:47 +01:00
|
|
|
|
2013-05-26 12:42:04 +10:00
|
|
|
void locfile_locate(struct locfile* l, location loc, const char* fmt, ...);
|
2012-09-11 12:24:54 +01:00
|
|
|
|
|
|
|
#endif
|