Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/parser/parse_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ ParseError::~ParseError() {}

LocatedParseError::~LocatedParseError() {}

void LocatedParseError::locate(size_t offset) {
if (finalized) {
void LocatedParseError::locate(size_t offset_) {
if (hasOffset) {
return;
}
std::ostringstream str;
str << reason << " at index " << offset << ".";
str << reason << " at index " << offset_ << ".";
reason = str.str();
finalized = true;
offset = offset_;
hasOffset = true;
}

}
4 changes: 2 additions & 2 deletions src/parser/parse_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class LocatedParseError : public ParseError {
~LocatedParseError() override;

void locate(size_t offset);
private:
bool finalized = false; //!< true when locate() has been called.
bool hasOffset = false; //!< true when locate() has been called.
size_t offset;
};

} // namespace ue2
Expand Down