! * \brief Get the current line context. * \return The current line context. */
| 249 | * \return The current line context. |
| 250 | */ |
| 251 | String GetSyntaxErrorContext(std::string err_prefix) const { |
| 252 | int64_t column = static_cast<int64_t>(cur_ - last_line_begin_) + 1; |
| 253 | int64_t char_pos = static_cast<int64_t>(cur_ - begin_); |
| 254 | if (err_prefix.empty()) { |
| 255 | err_prefix = "Syntax error"; |
| 256 | } |
| 257 | err_prefix += ": line " + std::to_string(line_counter_) + " column " + std::to_string(column) + |
| 258 | " (char " + std::to_string(char_pos) + ")"; |
| 259 | return String(err_prefix); |
| 260 | } |
| 261 | |
| 262 | std::string FinalizeErrorMsg() { |
| 263 | if (error_msg_.empty()) { |