parse_and_lex_context.cpp 757 B

1234567891011121314151617181920212223
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include "explorer/syntax/parse_and_lex_context.h"
  5. #include "explorer/common/error_builders.h"
  6. namespace Carbon {
  7. auto ParseAndLexContext::RecordSyntaxError(Error error) -> Parser::symbol_type {
  8. errors_.push_back(std::move(error));
  9. // TODO: use `YYerror` token once bison is upgraded to at least 3.5.
  10. return Parser::make_END_OF_FILE(current_token_position);
  11. }
  12. auto ParseAndLexContext::RecordSyntaxError(const std::string& message)
  13. -> Parser::symbol_type {
  14. return RecordSyntaxError(ProgramError(source_loc()) << message);
  15. }
  16. } // namespace Carbon