Re: infinite loop in spice parser

Vladimir Zhbanov <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
On Fri, Mar 29, 2013 at 08:15:02PM -0400, al davis wrote:
> Thanks for the bug report.
> 
> 
> On Friday 29 March 2013, Felix Salfelder wrote:
> > Hi Al, hi list.
> > 
> > playing with spicelib, i found the parser hanging at
> > gnucap-spice>C1 0 1 2;
> > 
> > while its not exceptionally clever to place that semicolon,
> > it's still a gnucap bug.
> > 
> > i fixed it with
> > 
> >      cmd >> node_name;
> > +    if(spots.back() == cmd.cursor()) {
> > +      throw Exception("what's this?");
> > +    }
> >      spots.push_back(cmd.cursor());
> 
> The usual gnucap way to handle that would be:
> 
>     unsigned here = cmd.cursor();
>     cmd >> node_name;
>     if (cmd.stuck(&here)) {
> .....
> 
> your way works too.
> 
> Having opened this one up .. What does Spice (NGspice?) do?
> 
> How does Spice (any of them) handle a semicolon?
> 
> What should it do?
> 
> Does that spice use a semicolon to introduce a comment?

SPICE 3 User's Manual [1] doesn't mention a semicolon in the syntax
definition chapter; moreover, it mentions it only in the section "Interactive
interpreter" [2] (search for the word "semicolon" there). In the
interactive mode a semicolon is considered a command separator. NGspice
support this behavior in the interactive mode, too; see [3]. In the
circuit description, NGspice supports several characters introducing
end-of-line comments including a semicolon, see the "End-of-line
comment" section in the NGspice user's manual [3].

[1] http://newton.ex.ac.uk/teaching/CDHW/Electronics2/userguide/
[2] http://newton.ex.ac.uk/teaching/CDHW/Electronics2/userguide/sec5.html#5.6
[3] http://ngspice.sourceforge.net/docs/ngspice-manual.pdf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.