tan  0.0.1
source_traceable.cpp
1 #include "ast/source_traceable.h"
2 #include "source_file/token.h"
3 
4 using namespace tanlang;
5 
6 TokenSpan::TokenSpan(uint32_t start, uint32_t end) : _start(start), _end(end) {}
7 
8 SourceTraceable::SourceTraceable(TokenizedSourceFile *src) : _span(TokenSpan(0, 0)), _src(src) {}
9 
10 uint32_t SourceTraceable::start() const { return _span._start; }
11 
12 uint32_t SourceTraceable::end() const { return _span._end; }
13 
14 void SourceTraceable::set_start(uint32_t val) { _span._start = val; }
15 
16 void SourceTraceable::set_end(uint32_t val) { _span._end = val; }
17 
18 TokenizedSourceFile *SourceTraceable::src() const { return _src; }
Different from SourceSpan, TokenSpan operates on the token level.
Different from SourceFile, TokenizedSourceFile manages the tokenized text of a source file.