parse_and_lex_context.cpp 842 B

1234567891011121314151617181920
  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 "executable_semantics/syntax/parse_and_lex_context.h"
  5. #include <cstring>
  6. #include <iostream>
  7. // Writes a syntax error diagnostic, containing message, for the input file at
  8. // the given line, to standard error.
  9. auto Carbon::ParseAndLexContext::PrintDiagnostic(const std::string& message,
  10. int line_num) -> void {
  11. // TODO: Do we really want this to be fatal? It makes the comment and the
  12. // name a lie, and renders some of the other yyparse() result propagation code
  13. // moot.
  14. std::cerr << input_file_name << ":" << line_num << ": " << message
  15. << std::endl;
  16. exit(-1);
  17. }