KenKundert / psf_utils

Read Spectre PSF files
49 stars 14 forks source link

parser error when current probe present #2

Closed JoopBanaan closed 3 years ago

JoopBanaan commented 3 years ago

When adding in the Spectre output a current probe, psf-utils fails with a parser error. When not adding a current in the result, only voltages, all works fine.

SCH_comparator/psf/tran.tran.tran(109): syntax error at 'PROP' "V1:p" "I" PROP(

Line 108-111 of the tran.tran.tran input file: TRACE "V1:p" "I" PROP( "units" "A" )

I use Spectre: Version 19.1.0.373.isr7 64bit -- 21 May 2020 psf-utils=1.0.0 ply=3.11 python=3.9

trace: ParseError Traceback (most recent call last) ~/.local/lib/python3.9/site-packages/psf_utils/psf.py in init(self, filename, sep, use_cache, update_cache) 74 content = psf_filepath.read_text() ---> 75 sections = parser.parse(filename, content) 76 except ParseError as e:

~/.local/lib/python3.9/site-packages/psf_utils/parse.py in parse(self, filename, content) 380 --> 381 result = self.parser.parse(content, tracking=False, lexer=self.lexer) 382 return result

~/.local/lib/python3.9/site-packages/ply/yacc.py in parse(self, input, lexer, debug, tracking, tokenfunc) 332 else: --> 333 return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) 334

~/.local/lib/python3.9/site-packages/ply/yacc.py in parseopt_notrack(self, input, lexer, debug, tracking, tokenfunc) 1200 self.state = state -> 1201 tok = call_errorfunc(self.errorfunc, errtoken, self) 1202 if self.errorok:

~/.local/lib/python3.9/site-packages/ply/yacc.py in call_errorfunc(errorfunc, token, parser) 191 _restart = parser.restart --> 192 r = errorfunc(token) 193 try:

~/.local/lib/python3.9/site-packages/psf_utils/parse.py in p_error(p) 365 loc = TokenLocation(p) --> 366 raise ParseError("syntax error at '%s'." % (p.value), loc) 367 else:

KenKundert commented 3 years ago

Spectre seems to be producing a variant of the PSF file that I have not seen before. Would you please send me the PSF file so I can try to adapt psf-utils to handle this variant.

JoopBanaan commented 3 years ago

Hi Ken, Thanks for the fast response. Attached the tran.tran.tran file with extension changed to .log to allow upload tran.tran.log

KenKundert commented 3 years ago

Okay, I think I fixed it. Can you get the latest version from github and make sure it works for you.

JoopBanaan commented 3 years ago

Indeed you fixed it. Thanks a lot