[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnucap-devel] infinite loop in spice parser
From: |
Vladimir Zhbanov |
Subject: |
Re: [Gnucap-devel] infinite loop in spice parser |
Date: |
Sat, 30 Mar 2013 21:10:25 +0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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