changeset 33099:12ba0316d483

Emit error, not warning, when unterminated block comment found (bug #59784) * lex.ll (handle_end_of_input): Change warning() to error(). Subtract 1 from reported line so that it matches end of file.
author Rik <rik@octave.org>
date Tue, 27 Feb 2024 20:32:13 -0800
parents db71211ac17b
children 0cee23f74ae9
files libinterp/parse-tree/lex.ll
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Tue Feb 27 16:43:26 2024 -0500
+++ b/libinterp/parse-tree/lex.ll	Tue Feb 27 20:32:13 2024 -0800
@@ -2491,12 +2491,14 @@
 
     if (m_block_comment_nesting_level != 0)
       {
-        warning ("block comment unterminated at end of input");
 
         if ((m_reading_fcn_file || m_reading_script_file || m_reading_classdef_file)
             && ! m_fcn_file_name.empty ())
-          warning ("near line %d of file '%s.m'",
-                   m_filepos.line (), m_fcn_file_name.c_str ());
+          error ("block comment unterminated at end of input\n"
+                 "near line %d of file '%s.m'",
+                 m_filepos.line () - 1, m_fcn_file_name.c_str ());
+        else
+          error ("block comment unterminated at end of input");
       }
 
     token *tok_val = new token (END_OF_INPUT, m_tok_beg, m_tok_end);