Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add steepcheck for lib/lrama/grammar/parameterizing_rules/**/*.rb #260

Merged
merged 8 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target :lib do
check "lib/lrama/grammar/code.rb"
check "lib/lrama/grammar/counter.rb"
check "lib/lrama/grammar/error_token.rb"
check "lib/lrama/grammar/parameterizing_rules"
check "lib/lrama/grammar/percent_code.rb"
check "lib/lrama/grammar/precedence.rb"
check "lib/lrama/grammar/printer.rb"
Expand Down
4 changes: 4 additions & 0 deletions lib/lrama/grammar/parameterizing_rules/builder/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def initialize(token, rule_counter, lhs_tag, user_code, precedence_sym, line)
@build_token = nil
end

def build
raise NotImplementedError
end

private

def validate_argument_number!
Expand Down
12 changes: 12 additions & 0 deletions sig/lrama/grammar/parameterizing_rules/builder.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ module Lrama
class Grammar
class ParameterizingRules
class Builder
RULES: Hash[Symbol, singleton(Base)]

@token: Lexer::Token::Parameterizing
@key: Symbol
@rule_counter: Counter
@lhs: Lexer::Token
@user_code: Lexer::Token::UserCode?
@precedence_sym: Lexer::Token?
@line: Integer?

def initialize: (Lexer::Token token, Counter rule_counter, untyped lhs_tag, Lexer::Token::UserCode? user_code, Lexer::Token? precedence_sym, Integer? line) -> void
def build: () -> Array[Rule]
def build_token: () -> Lrama::Lexer::Token
def create_builder: () -> void
def validate_key!: () -> void
end
end
end
Expand Down
26 changes: 26 additions & 0 deletions sig/lrama/grammar/parameterizing_rules/builder/base.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module Lrama
class Grammar
class ParameterizingRules
class Builder
class Base
def initialize: (Lexer::Token::Parameterizing token, Counter rule_counter, untyped lhs_tag, Lexer::Token::UserCode? user_code, Lexer::Token? precedence_sym, Integer? line) -> void
def build: () -> Array[Rule]

@args: Array[Lexer::Token]
@token: Lexer::Token::Parameterizing
@key: Symbol
@rule_counter: Counter
@lhs: Lexer::Token
@user_code: Lexer::Token::UserCode?
@precedence_sym: Lexer::Token?
@line: Integer?
@expected_argument_num: Integer

private

def validate_argument_number!: () -> void
end
end
end
end
end
10 changes: 10 additions & 0 deletions sig/lrama/grammar/parameterizing_rules/builder/list.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Lrama
class Grammar
class ParameterizingRules
class Builder
class List < Base
end
end
end
end
end
10 changes: 10 additions & 0 deletions sig/lrama/grammar/parameterizing_rules/builder/nonempty_list.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Lrama
class Grammar
class ParameterizingRules
class Builder
class NonemptyList < Base
end
end
end
end
end
10 changes: 10 additions & 0 deletions sig/lrama/grammar/parameterizing_rules/builder/option.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Lrama
class Grammar
class ParameterizingRules
class Builder
class Option < Base
end
end
end
end
end
11 changes: 11 additions & 0 deletions sig/lrama/grammar/parameterizing_rules/builder/separated_list.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Lrama
class Grammar
class ParameterizingRules
class Builder
class SeparatedList < Base
def initialize: (Lexer::Token token, Counter rule_counter, untyped lhs_tag, Lexer::Token::UserCode? user_code, Lexer::Token? precedence_sym, Integer? line) -> void
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Lrama
class Grammar
class ParameterizingRules
class Builder
class SeparatedNonemptyList < Base
def initialize: (Lexer::Token token, Counter rule_counter, untyped lhs_tag, Lexer::Token::UserCode? user_code, Lexer::Token? precedence_sym, Integer? line) -> void
end
end
end
end
end