[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Comments in data -- bug??
From: |
John W. Eaton |
Subject: |
Comments in data -- bug?? |
Date: |
Wed, 23 Sep 1998 21:20:31 -0500 (CDT) |
On 23-Sep-1998, (Ted Harding) <address@hidden> wrote:
| I want to put comments on the lines of data in an m-file defining
| matrices, e.g.
|
| data_1994 = [
| 10 25 % 20 Apr 1994
| 3 14
| 13 39
| 12 21
| 24 42
| 6 12
| 2 15
| 3 4
| 8 16
| 5 12
| 29 56 % 30 Apr 1994
| ];
|
| However, on being run, this gives me:
|
| parse error near line 3 of file temp.m
|
| >>> 3 14
| ^
|
| parse error near line 4 of file temp.m
|
| >>> 13 39
| ^
|
| and so on. Now I change it so that there are no spaces at the beginning
| of the line:
|
| data_1994 = [
| 10 25 % 20 Apr 1994
| 03 14
| 13 39
| 12 21
| 24 42
| 06 12
| 02 15
| 03 4
| 08 16
| 05 12
| 29 56 % 30 Apr 1994
| ];
|
| and it works perfectly (of course, without the comments it also works,
| spaces or no spaces). This change of behaviour, depending on whether
| there is a space or not, strikes me as anomalous: the Manual says "The
| Octave interpreter ignores the rest of the line following a sharp sign or
| a percent symbol", which is what happens in the second case and
| presumably should also happen in the first.
|
| Bug?? (Octave, version 2.0.13 (i586-pc-linux-gnulibc1), compiled by me).
It looks like a bug to me. Please try the following patch. Also,
please report bugs to the bug-octave mailing list instead of
help-octave.
Thanks,
jwe
*** src/lex.l~ Sun May 3 14:46:19 1998
--- src/lex.l Wed Sep 23 21:08:26 1998
***************
*** 335,341 ****
// semicolons.
%}
! <MATRIX>{SNLCMT}*\n{SNLCMT}* {
fixup_column_count (yytext);
eat_whitespace ();
if (Vwhitespace_in_literal_matrix != 2)
--- 335,342 ----
// semicolons.
%}
! <MATRIX>{S}*{COMMENT}{SNLCMT}* |
! <MATRIX>{S}*{NL}{SNLCMT}* {
fixup_column_count (yytext);
eat_whitespace ();
if (Vwhitespace_in_literal_matrix != 2)