octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parser problem?


From: Ben Abbott
Subject: Re: parser problem?
Date: Fri, 13 Mar 2009 20:30:51 +0800


On Mar 13, 2009, at 3:36 PM, John W. Eaton wrote:

On 13-Mar-2009, Ben Abbott wrote:

| On Mar 13, 2009, at 10:56 AM, Ben Abbott wrote:
|
| > Do I infer correctly that this is a parser problem?
| >
| > octave:1> warning error
| > octave:2> help cellstr
| > error: potential auto-insertion of `,' near line 47 of file / Users/
| > bpabbott/Development/mercurial/octave-3.1.54/scripts/help/which.m
| > error: called from:
| > error: /Users/bpabbott/Development/mercurial/octave-3.1.54/ scripts/
| > help/help.m at line 81, column 5
| > octave:2> help test
| > error: potential auto-insertion of `,' near line 89 of file / Users/ | > bpabbott/Development/mercurial/octave-3.1.54/scripts/strings/ strcat.m
| > error: called from:
| > error: /Users/bpabbott/Development/mercurial/octave-3.1.54/ scripts/
| > help/__makeinfo__.m at line 154, column 12
| > error: /Users/bpabbott/Development/mercurial/octave-3.1.54/ scripts/
| > help/__makeinfo__.m at line 111, column 16
| > error: /Users/bpabbott/Development/mercurial/octave-3.1.54/ scripts/
| > help/help.m at line 62, column 25
| > octave:2>
| >
| > Line 47 of which.m is
| >
| >  varargout = {m.file};
| >
| > Line 89 of strchr.m is
| >
| >        varargin{nv}(:) = {str};
| >
| > From the Octave prompt
| >
| > octave:6> warning error
| > octave:7> a = "a";
| > octave:8> b = {a}
| > error: potential auto-insertion of `,' near line 8
| > octave:8> b = {(a)}
| > b =
| >
| > {
| >  [1,1] = a
| > }
| >
| > octave:9> b = {a(:)}
| > b =
| >
| > {
| >  [1,1] = a
| > }
| >
| > Ben
| >
| > p.s. my last build was about 2 days ago.
|
| another example
|
| octave:16> a = 1;
| octave:17> b = {a, a}
| error: potential auto-insertion of `,' near line 17
| octave:17> b = {1, 1}
| b =
|
| {
|    [1,1] =  1
|    [1,2] =  1
| }
|
| octave:18> b = {a, a,} ## notice the 2nd comma
| b =
|
| {
|    [1,1] =  1
|    [1,2] =  1
| }

The following change will avoid this problem.  But I don't think it is
a complete solution.  I'd guess that there are some other cases that
will incorrectly trigger this warning message.

jwe

diff --git a/src/lex.l b/src/lex.l
--- a/src/lex.l
+++ b/src/lex.l
@@ -2812,6 +2812,11 @@
      if (index_op && ! spc_gobbled)
        return;

+      // There is no need to insert a comma if the next token ends a
+      // matrix or cell array list.
+      if (c1 == ']' || c1 == '}')
+       return;
+
      maybe_warn_separator_insert (',');

      xunput (',', yytext);

Works for me!

Thanks
Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]