alex / rply

An attempt to port David Beazley's PLY to RPython, and give it a cooler API.
BSD 3-Clause "New" or "Revised" License
381 stars 60 forks source link

Getting KeyError: 'var_value' #91

Closed bifunctor closed 5 years ago

bifunctor commented 5 years ago

I am making a code with rply, when I came across an error. I got a KeyError: 'var_value' when I ran a bit of code. The full error is listed below:

Traceback (most recent call last):
  File "/Users/User1/Project1/run.py", line 13, in <module>
    parser = pg.get_parser()
  File "/Users/User1/Project1/parser.py", line 74, in get_parser
    return self.pg.build()
  File "/usr/local/lib/python2.7/site-packages/rply/parsergenerator.py", line 172, in build
    g.compute_first()
  File "/usr/local/lib/python2.7/site-packages/rply/grammar.py", line 148, in compute_first
    for p in self.prod_names[n]:
KeyError: 'var_value'

Here is the snippet of my code where the error seems to have happened:

@self.pg.production('statement : VARIABLE var_name EQUAL var_value SEMI_COLON')

Why am I getting the KeyError: 'var_value' error? Is there something I can do to fix it?

bifunctor commented 5 years ago

I found out why; Its because there is no built-in var_value!