mwisslead/vfp2py

Error while running tests

KClough opened this issue · 2 comments

ERROR: testbed.test_conversion.Test0
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/kevinclough/Projects/Jarvus/vfp2py/.eggs/nose-1.3.7-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/kevinclough/Projects/Jarvus/vfp2py/testbed/test_conversion.py", line 59, in Test0
    test_output_str = vfp2py.vfp2py.prg2py(input_str, parser_start='lines', prepend_data='').strip()
  File "/Users/kevinclough/Projects/Jarvus/vfp2py/vfp2py/vfp2py.py", line 401, in prg2py
    tokens = preprocess_code(data).tokens
  File "/Users/kevinclough/Projects/Jarvus/vfp2py/vfp2py/vfp2py.py", line 198, in preprocess_code
    tree = parser.preprocessorCode()
  File "/Users/kevinclough/Projects/Jarvus/vfp2py/vfp2py/VisualFoxpro9Parser.py", line 1562, in preprocessorCode
    self.nonpreprocessorLine()
  File "/Users/kevinclough/Projects/Jarvus/vfp2py/vfp2py/VisualFoxpro9Parser.py", line 1903, in nonpreprocessorLine
    self.consume()
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/Parser.py", line 324, in consume
    self.getInputStream().consume()
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/BufferedTokenStream.py", line 97, in consume
    if self.sync(self.index + 1):
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/BufferedTokenStream.py", line 109, in sync
    fetched = self.fetch(n)
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/BufferedTokenStream.py", line 121, in fetch
    t = self.tokenSource.nextToken()
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/Lexer.py", line 126, in nextToken
    ttype = self._interp.match(self._input, self._mode)
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/atn/LexerATNSimulator.py", line 94, in match
    return self.execATN(input, dfa.s0)
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/atn/LexerATNSimulator.py", line 163, in execATN
    target = self.computeTargetState(input, s, t)
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/atn/LexerATNSimulator.py", line 221, in computeTargetState
    self.getReachableConfigSet(input, s.configs, reach, t)
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/atn/LexerATNSimulator.py", line 270, in getReachableConfigSet
    if self.closure(input, config, reach, currentAltReachedAcceptState, True, treatEofAsEpsilon):
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/atn/LexerATNSimulator.py", line 349, in closure
    currentAltReachedAcceptState = self.closure(input, c, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon)
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/atn/LexerATNSimulator.py", line 337, in closure
    currentAltReachedAcceptState, speculative, treatEofAsEpsilon)
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/atn/LexerATNSimulator.py", line 347, in closure
    c = self.getEpsilonTarget(input, config, t, configs, speculative, treatEofAsEpsilon)
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/atn/LexerATNSimulator.py", line 385, in getEpsilonTarget
    if self.evaluatePredicate(input, t.ruleIndex, t.predIndex, speculative):
  File "build/bdist.macosx-10.11-x86_64/egg/antlr4/atn/LexerATNSimulator.py", line 454, in evaluatePredicate
    return self.recog.sempred(None, ruleIndex, predIndex)
  File "/Users/kevinclough/Projects/Jarvus/vfp2py/vfp2py/VisualFoxpro9Lexer.py", line 1768, in sempred
    return pred(localctx, predIndex)
  File "/Users/kevinclough/Projects/Jarvus/vfp2py/vfp2py/VisualFoxpro9Lexer.py", line 1774, in LINECOMMENT_sempred
    return _tokenStartCharPositionInLine == 0
NameError: global name '_tokenStartCharPositionInLine' is not defined```

I'm getting this error when I run `python setup.py test`

Hi Kevin. Hadn't noticed that you had raised this issue. This issue is caused by my attempt to make the grammar file work for java. In order to work with python references to _tokenStartCharPositionInLine have to be changed to self._tokenStartColumn. In the vfp2py folder there is a Makefile that would do this automatically for linux. This could also be avoided if the generated python was added to the repository.

You're the first person to have attempted using it that I know of so user friendliness hasn't been a priority.

I went ahead and added the files that should be needed to get started easier. Let me know how it works for you.