summaryrefslogtreecommitdiffstats
path: root/locfile.h
blob: 4e20df274160fda4d8d53af5d3cb8151b21462f1 (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
#ifndef _LOCFILE_H
#define _LOCFILE_H

#include "jq.h"

typedef struct {
  int start, end;
} location;

static const location UNKNOWN_LOCATION = {-1, -1};

struct locfile {
  const char* data;
  int length;
  int* linemap;
  int nlines;
  char *error;
  jq_state *jq;
};

void locfile_init(struct locfile* l, jq_state *jq, const char* data, int length);

void locfile_free(struct locfile* l);

void locfile_locate(struct locfile* l, location loc, const char* fmt, ...);

#endif