Runtime errors
commodapse0q opened this issue · 4 comments
Hi again! Was trying to convert a file over and got some errors that spit out. I'm assuming the errors I'm getting are from something I approached incorrectly, but here is the full output for development reference. I've got some files that are 8 thousand lines long of FoxPro so hoping we can get this figured out!
Let me know if there's anything I can do to help!
sh-3.2# vfp2py --logging /Users/login/Downloads/0bin_BKP1Vpxs.prg /Users/login/Downloads/Output.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/vfp2py.py", line 465, in run_parser
return getattr(parser, parser_start)()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2080, in prg
self.funcDef()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2924, in funcDef
self.lines()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2364, in lines
self.line()
^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2255, in line
self.controlStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 4029, in controlStmt
self.ifStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 3068, in ifStmt
localctx.ifBody = self.lines()
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2364, in lines
self.line()
^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2255, in line
self.controlStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 4029, in controlStmt
self.ifStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 3068, in ifStmt
localctx.ifBody = self.lines()
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2364, in lines
self.line()
^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2255, in line
self.controlStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 4029, in controlStmt
self.ifStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 3078, in ifStmt
localctx.elseBody = self.lines()
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2364, in lines
self.line()
^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2265, in line
self.lineEnd()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2313, in lineEnd
self._errHandler.recoverInline(self)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/antlr4/error/ErrorStrategy.py", line 703, in recoverInline
self.recover(recognizer, InputMismatchException(recognizer))
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/antlr4/error/ErrorStrategy.py", line 697, in recover
raise ParseCancellationException(e)
antlr4.error.Errors.ParseCancellationException: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/bin/vfp2py", line 33, in <module>
sys.exit(load_entry_point('vfp2py==0.1.0', 'console_scripts', 'vfp2py')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/__main__.py", line 28, in main
vfp2py.convert_file(args.infile, args.outpath, encoding=args.encoding)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/vfp2py.py", line 536, in convert_file
output = prg2py_after_preproc(data, 'prg', os.path.splitext(os.path.basename(infile))[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/vfp2py.py", line 479, in prg2py_after_preproc
tree = run_parser(stream, parser, parser_start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/vfp2py.py", line 472, in run_parser
return getattr(parser, parser_start)()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2080, in prg
self.funcDef()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2924, in funcDef
self.lines()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2364, in lines
self.line()
^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2255, in line
self.controlStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 4029, in controlStmt
self.ifStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 3068, in ifStmt
localctx.ifBody = self.lines()
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2364, in lines
self.line()
^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2255, in line
self.controlStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 4029, in controlStmt
self.ifStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 3068, in ifStmt
localctx.ifBody = self.lines()
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2364, in lines
self.line()
^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2255, in line
self.controlStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 4029, in controlStmt
self.ifStmt()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 3078, in ifStmt
localctx.elseBody = self.lines()
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2364, in lines
self.line()
^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2265, in line
self.lineEnd()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/VisualFoxpro9Parser.py", line 2313, in lineEnd
self._errHandler.recoverInline(self)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/antlr4/error/ErrorStrategy.py", line 403, in recoverInline
if self.singleTokenInsertion(recognizer):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/antlr4/error/ErrorStrategy.py", line 436, in singleTokenInsertion
self.reportMissingToken(recognizer)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/antlr4/error/ErrorStrategy.py", line 344, in reportMissingToken
recognizer.notifyErrorListeners(msg, t, None)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/antlr4/Parser.py", line 322, in notifyErrorListeners
listener.syntaxError(self, offendingToken, line, column, msg, e)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/antlr4/error/ErrorListener.py", line 60, in syntaxError
delegate.syntaxError(recognizer, offendingSymbol, line, column, msg, e)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vfp2py/vfp2py.py", line 458, in syntaxError
raise Exception('Syntax Error on line {}: {}'.format(line, linetxt))
Exception: Syntax Error on line 166: ENDIF IF RECCOUNT()=0
Syntax error on line 166. Can you verify the line really is ENDIF IF RECCOUNT()=0?
The parser won't handle that. I'm not sure if foxpro would even consider that valid. I'll check foxpro to see but usually it just silently ignores a line like that and the next ENDIF line gets used to close the original IF line making the program behave in an unexpected way so my parser might just be helping you fix it.
Checked foxpro and it just ignores everything after ENDIF so I wasn't exactly correct but I can't imagine that would be what is intended in your program either.
Yeah, Honestly I will have to research this on my own and get back to you. I'm currently trying to chug through over 42k lines of FoxPro left to me by a legacy developer so I'm still learning the nuances of FoxPro. I'll probably need to manually clean the code of useless / commented-out code first.
I have not had the time available to do due diligence on my part regarding this issue so I'm going to close this one out.