KenKundert / psf_utils

Read Spectre PSF files
49 stars 14 forks source link

unknown keyword 'STRING' for string arrays in struct declarations #13

Closed KristofferC closed 2 years ago

KristofferC commented 2 years ago

Trying to read this file https://github.com/KenKundert/psf_utils/blob/master/samples/pnoise.raw/logFile seems to error:

>>> psf = PSF('logFile', use_cache=False)
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/psf_utils/psf.py", line 86, in __init__
    sections = parser.parse(filename, content)
  File "/usr/local/lib/python3.9/site-packages/psf_utils/parse.py", line 488, in parse
    result = self.parser.parse(content, tracking=False, lexer=self.lexer)
  File "/usr/local/lib/python3.9/site-packages/ply/yacc.py", line 265, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "/usr/local/lib/python3.9/site-packages/ply/yacc.py", line 921, in parseopt_notrack
    lookahead = get_token()     # Get the next token
  File "/usr/local/lib/python3.9/site-packages/ply/lex.py", line 348, in token
    newtok = func(tok)
  File "/usr/local/lib/python3.9/site-packages/psf_utils/parse.py", line 156, in t_ID
    raise ParseError(f"unknown keyword '{t.value}'.", loc)
psf_utils.parse.ParseError: logFile(16): unknown keyword 'STRING'.
    "analysisType" STRING *
                   ^

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/psf_utils/psf.py", line 88, in __init__
    raise Error(str(e))
inform.inform.Error: logFile(16): unknown keyword 'STRING'.
    "analysisType" STRING *
KenKundert commented 2 years ago

The intent of psf_utils is to allow you to gain access to your simulation data. I did not intend it to be a full implementation of the PSF protocol. As such, I did not design it to read the PSF log files or degenerate PSF files with no data. Having said that, I would prefer if it were able to at least parse a valid PSF file. So I made some extensions to try to read this file, but it this a deep hole. Fixing one issue reveals another. After about four or five, there was still no end in sight. Further, it is not clear that anything useful can come of this as the interface is really not designed for providing access to the information in a log file.

So unless there is some strong need for access to the information contained in this file, I am inclined not to fix this issue.

KristofferC commented 2 years ago

Okay, that makes sense. Feel free to close :)