summaryrefslogtreecommitdiff
path: root/src/context.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/context.h')
-rw-r--r--src/context.h32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/context.h b/src/context.h
index 3851d073..899c9b88 100644
--- a/src/context.h
+++ b/src/context.h
@@ -7,20 +7,30 @@ class context
{
public:
string context; // ex: 'While parsing file "%R" at line %L'
+};
+
+class file_context : public context
+{
+public:
+ path pathname; // ex: ledger.dat
- string resource; // ex: ledger.dat
- long linenum_beg; // ex: 1010
- long linenum_end; // ex: 1010
- long colnum_beg; // ex: 8
- long colnum_end; // ex: 8
- long position_beg;
- long position_end;
+ 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)
- long linenum_beg_off; // ex: 2 / -1 means start at beginning
- long linenum_end_off; // ex: 2 / -1 means start at beginning
- long colnum_beg_off; // ex: 8 / -1 means start
- long colnum_end_off; // ex: 8 / -1 means start
+
+ 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