Mercurial > hg > octave-nkf
changeset 335:04d35aba48e3
[project @ 1994-02-07 01:08:21 by jwe]
author | jwe |
---|---|
date | Mon, 07 Feb 1994 01:08:21 +0000 |
parents | 6000e81b72b4 |
children | a8884233bd0a |
files | src/parse.y |
diffstat | 1 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parse.y +++ b/src/parse.y @@ -1110,8 +1110,8 @@ { char *line = current_input_line; int err_col = current_input_column - 1; - if (err_col == 0) - err_col = strlen (current_input_line) + 1; + if (err_col == 0 && line != (char *) NULL) + err_col = strlen (line) + 1; // Print a message like `parse error'. fprintf (stderr, "\n%s", s); @@ -1121,18 +1121,20 @@ fprintf (stderr, " near line %d of file %s.m", input_line_number, curr_m_file_name); - int len = strlen (line); - if (line[len-1] == '\n') + if (line != (char *) NULL) { - len--; - line[len] = '\0'; + int len = strlen (line); + if (line[len-1] == '\n') + { + len--; + line[len] = '\0'; + } +// Print the line, maybe with a pointer near the error token. + if (err_col > len) + fprintf (stderr, ":\n\n %s\n\n", line); + else + fprintf (stderr, ":\n\n %s\n %*s\n\n", line, err_col, "^"); } - -// Print the line, maybe with a pointer near the error token. - if (err_col > len) - fprintf (stderr, ":\n\n %s\n\n", line); - else - fprintf (stderr, ":\n\n %s\n %*s\n\n", line, err_col, "^"); } static int