Fix some lints

This commit is contained in:
John Doty 2018-03-21 20:13:18 -07:00
parent a96c88a39e
commit 3218367c65

View file

@ -133,13 +133,13 @@ class GenerateLR0(object):
# rule, and in the set of states and table and whatever the first # rule, and in the set of states and table and whatever the first
# element is always the starting state/position. # element is always the starting state/position.
self.grammar = [('__start', [start])] + grammar self.grammar = [('__start', [start])] + grammar
self.nonterminals = set(rule[0] for rule in grammar) self.nonterminals = {rule[0] for rule in grammar}
self.terminals = set( self.terminals = {
sym sym
for name, symbols in grammar for name, symbols in grammar
for sym in symbols for sym in symbols
if sym not in self.nonterminals if sym not in self.nonterminals
) }
self.alphabet = self.terminals | self.nonterminals self.alphabet = self.terminals | self.nonterminals
# Check to make sure they didn't use anything that will give us # Check to make sure they didn't use anything that will give us