1
2
3
4
5
6 #ifndef SOULNG_LEXER_SPAN_INCLUDED
7 #define SOULNG_LEXER_SPAN_INCLUDED
8 #include <soulng/lexer/LexerApi.hpp>
9
10 namespace soulng { namespace lexer {
11
12 struct Span
13 {
14 Span() : fileIndex(-1), line(-1), start(-1), end(-1) {}
15 Span(int fileIndex_, int line_, int start_) : fileIndex(fileIndex_), line(line_), start(start_), end(start) {}
16 Span(int fileIndex_, int line_, int start_, int end_) : fileIndex(fileIndex_), line(line_), start(start_), end(end_) {}
17 bool Valid() const { return fileIndex != -1 && line != -1 && start != -1 && end != -1; }
18 int fileIndex;
19 int line;
20 int start;
21 int end;
22 };
23
24 bool operator==(const Span& left, const Span& right);
25
26 } }
27
28 #endif // SOULNG_LEXER_SPAN_INCLUDED