Skip to content

Commit

Permalink
Fix _derivations to be non-null
Browse files Browse the repository at this point in the history
Co-authored-by: yui-knk <[email protected]>
  • Loading branch information
Little-Rubyist and yui-knk committed Dec 21, 2024
1 parent 8668c40 commit 613c68e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/lrama/counterexamples/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def derivations2
private

def _derivations(paths)
derivation = nil #: Derivation?
derivation = nil #: Derivation
current = :production
last_path = paths.last #: Path
lookahead_sym = last_path.to.item.end_of_rule? ? @conflict_symbol : nil
Expand All @@ -59,7 +59,7 @@ def _derivations(paths)
derivation = Derivation.new(item, derivation)
current = :production
else
return nil
raise "Unexpected. #{path}"
end

if lookahead_sym && item.next_next_sym && item.next_next_sym.first_set.include?(lookahead_sym)
Expand Down
6 changes: 3 additions & 3 deletions sig/lrama/counterexamples/example.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ module Lrama

def path2_item: () -> States::Item

def derivations1: () -> Derivation?
def derivations1: () -> Derivation

def derivations2: () -> Derivation?
def derivations2: () -> Derivation

private

def _derivations: (::Array[StartPath | TransitionPath | ProductionPath] paths) -> Derivation?
def _derivations: (::Array[StartPath | TransitionPath | ProductionPath] paths) -> Derivation

def find_derivation_for_symbol: (StateItem state_item, Grammar::Symbol sym) -> Derivation?
end
Expand Down

0 comments on commit 613c68e

Please sign in to comment.