Change lookahead_item_shift() to lookahead_item_set_action() to reflect that it retur...
authorNick Downing <downing.nick@gmail.com>
Wed, 11 Jul 2018 07:14:26 +0000 (17:14 +1000)
committerNick Downing <downing.nick@gmail.com>
Wed, 11 Jul 2018 07:14:26 +0000 (17:14 +1000)
lr1.py

diff --git a/lr1.py b/lr1.py
index 4d4b410..d44a63f 100644 (file)
--- a/lr1.py
+++ b/lr1.py
@@ -94,7 +94,7 @@ class LR1:
                 queue.append(n)
       qhead += 1 
 
-  def lookahead_item_set_shift(self, items, terminal):
+  def lookahead_item_set_action(self, items, terminal):
     next_items = []
     next_item_to_index = {}
     reductions = set()
@@ -153,7 +153,7 @@ class LR1:
       value_stack.append(i)
       state_stack.append(items)
       items, item_to_index, reductions, _, _ = (
-        self.lookahead_item_set_shift(items, lookahead_character)
+        self.lookahead_item_set_action(items, lookahead_character)
       )
       if len(items) != 0:
         if len(reductions) != 0:
@@ -227,7 +227,7 @@ class LR1:
       value_stack.append((pos, off))
       state_stack.append(items)
       items, item_to_index, reductions, _, _ = (
-        self.lookahead_item_set_shift(items, lookahead_character)
+        self.lookahead_item_set_action(items, lookahead_character)
       )
       if len(items) != 0:
         if len(reductions) != 0:
@@ -344,7 +344,7 @@ class LR1:
       terminal = 0
       while terminal < self.n_terminals:
         next_items, next_item_to_index, reductions, terminal0, terminal1 = (
-          self.lookahead_item_set_shift(items, terminal)
+          self.lookahead_item_set_action(items, terminal)
         )
         assert terminal0 == terminal and terminal1 > terminal
         if len(next_items) != 0:
@@ -445,7 +445,7 @@ class LR1:
       terminal = 0
       while terminal < self.n_terminals:
         next_items, next_item_to_index, reductions, terminal0, terminal1 = (
-          self.lookahead_item_set_shift(items, terminal)
+          self.lookahead_item_set_action(items, terminal)
         )
         assert terminal0 == terminal and terminal1 > terminal
         if len(next_items) != 0: