Re: infinite loop in spice parser

Felix Salfelder <[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:
> The usual gnucap way to handle that would be:
> 
>     unsigned here = cmd.cursor();
>     cmd >> node_name;
>     if (cmd.stuck(&here)) {

> your way works too.

because "here" has been pushed back already... "stuck" is more elegant,
of course.

> Having opened this one up .. What does Spice (NGspice?) do?
> How does Spice (any of them) handle a semicolon?
> What should it do?

i dont know, couldnt find a spice syntax definition.

> Does that spice use a semicolon to introduce a comment?

if net contains

C1 1 2 3
C2 1 2 3;
C3 1 2 3; commnt

i get
$ ngpice net
ngspice 1 -> listing


     1 : 
     2 : c1 1 2 3
     3 : c2 1 2 3
     4 : c3 1 2 3
     5 : .end

> It seems to me that perhaps the semicolon should be treated as 
> "end of statement".
> [..]
>  so perhaps ...
>     }else if (cmd.skip1b(';') || cmd.is_end()) {

i think "start of comment" won't hurt. but then CS::get_line would be
the place to handle it, right?

> It still needs the check for "stuck".

not the proposed one, it breaks subcircuits without ports. i'd guess they
should be allowed. :|

regards
felix
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.