diff options
author | dos-reis <gdr@axiomatics.org> | 2014-08-27 08:23:24 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2014-08-27 08:23:24 +0000 |
commit | f54a0b26ac1459b452cf30cafe87468f12c96c19 (patch) | |
tree | 38dd795bca9520b14198f2dc4f7080e57fe88b3f /src/boot | |
parent | 65dfcc0a0e53c2fa74f62fe2eb69d7e37149475f (diff) | |
download | open-axiom-f54a0b26ac1459b452cf30cafe87468f12c96c19.tar.gz |
Tidy TokenStream<>::get()
Diffstat (limited to 'src/boot')
-rw-r--r-- | src/boot/bemol.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/boot/bemol.cc b/src/boot/bemol.cc index 0399bb44..bff97039 100644 --- a/src/boot/bemol.cc +++ b/src/boot/bemol.cc @@ -74,6 +74,20 @@ struct Fragment : std::vector<Line> { ColumnIndex last_indent() const { return empty() ? 0 : back().indent; } + using std::vector<Line>::operator[]; + const Line& operator()(const OpenAxiom::FragmentCursor& pos) const { + return (*this)[pos.line]; + } + uint8_t operator[](const OpenAxiom::FragmentCursor& pos) const { + return (*this)[pos.line][pos.column]; + } + uint8_t advance(OpenAxiom::FragmentCursor& pos) const { + return (*this)[pos.line][pos.column++]; + } + + bool covering(const OpenAxiom::FragmentCursor& pos) const { + return pos.column < (*this)[pos.line].size(); + } }; // Formatting program fragments. |