From 2f45b40d771f128e90ac7303582678120ef077ad Mon Sep 17 00:00:00 2001 From: Little_Rubyist Date: Tue, 16 Jul 2024 19:30:54 +0900 Subject: [PATCH] Add types for initialize method --- sig/lrama/state/reduce_reduce_conflict.rbs | 8 +++++--- sig/lrama/state/resolved_conflict.rbs | 2 ++ sig/lrama/state/shift_reduce_conflict.rbs | 8 +++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sig/lrama/state/reduce_reduce_conflict.rbs b/sig/lrama/state/reduce_reduce_conflict.rbs index 2d8ecf9a..23ced680 100644 --- a/sig/lrama/state/reduce_reduce_conflict.rbs +++ b/sig/lrama/state/reduce_reduce_conflict.rbs @@ -1,9 +1,11 @@ module Lrama class State class ReduceReduceConflict - attr_accessor symbols: Array[Grammar::Symbol?] - attr_accessor reduce1: State::Reduce - attr_accessor reduce2: State::Reduce + attr_accessor symbols: Array[Grammar::Symbol?] + attr_accessor reduce1: State::Reduce + attr_accessor reduce2: State::Reduce + + def initialize: (?symbols: Array[Grammar::Symbol?], ?reduce1: State::Reduce, ?reduce2: State::Reduce) -> void def type: () -> :reduce_reduce end diff --git a/sig/lrama/state/resolved_conflict.rbs b/sig/lrama/state/resolved_conflict.rbs index 4856608f..76be9469 100644 --- a/sig/lrama/state/resolved_conflict.rbs +++ b/sig/lrama/state/resolved_conflict.rbs @@ -6,6 +6,8 @@ module Lrama attr_accessor which: (:reduce | :shift) attr_accessor same_prec: bool + def initialize: (?symbol: Grammar::Symbol, ?reduce: State::Reduce, ?which: (:reduce | :shift), ?same_prec: bool) -> void + def report_message: () -> (::String | bot) end end diff --git a/sig/lrama/state/shift_reduce_conflict.rbs b/sig/lrama/state/shift_reduce_conflict.rbs index 74e5c102..af878342 100644 --- a/sig/lrama/state/shift_reduce_conflict.rbs +++ b/sig/lrama/state/shift_reduce_conflict.rbs @@ -1,9 +1,11 @@ module Lrama class State class ShiftReduceConflict - attr_accessor symbols: Array[Grammar::Symbol] - attr_accessor shift: State::Shift - attr_accessor reduce: State::Reduce + attr_accessor symbols: Array[Grammar::Symbol] + attr_accessor shift: State::Shift + attr_accessor reduce: State::Reduce + + def initialize: (?symbols: Array[Grammar::Symbol], ?shift: State::Shift, ?reduce: State::Reduce) -> void def type: () -> :shift_reduce end