summaryrefslogtreecommitdiff
path: root/src/context.h
blob: 899c9b8879834e2dbe23b6bb4142a1a088fc0d4c (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
#ifndef _CONTEXT_H
#define _CONTEXT_H

namespace ledger {

class context
{
public:
  string context;		// ex: 'While parsing file "%R" at line %L'
};

class file_context : public context
{
public:
  path pathname;		// ex: ledger.dat

  optional<long> linenum_beg;	// ex: 1010
  optional<long> linenum_end;	// ex: 1010
  optional<long> colnum_beg;	// ex: 8
  optional<long> colnum_end;	// ex: 8
  optional<long> position_beg;
  optional<long> position_end;
};

class string_context : public context
{
public:
  string text;			// ex: (The multi-line text of an entry)

  optional<long> linenum_beg_off; // ex: 2 / none means start at beginning
  optional<long> linenum_end_off; // ex: 2 / none means start at beginning
  optional<long> colnum_beg_off; // ex: 8 / none means start
  optional<long> colnum_end_off; // ex: 8 / none means start
};

} // namespace ledger

#endif // _CONTEXT_H