parse_and_lex_context.cpp 904 B

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