Skip to content

Commit

Permalink
Passing actual code to PercentCode
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Dec 25, 2023
1 parent 76a80b6 commit 5a43cf2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/lrama/grammar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def initialize(rule_counter)
end

def add_percent_code(id:, code:)
@percent_codes << PercentCode.new(id.s_value, code)
@percent_codes << PercentCode.new(id.s_value, code.s_value)
end

def add_printer(ident_or_tags:, token_code:, lineno:)
Expand Down
2 changes: 1 addition & 1 deletion lib/lrama/output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def percent_code(name)
@grammar.percent_codes.select do |percent_code|
percent_code.name == name
end.map do |percent_code|
percent_code.code.s_value
percent_code.code
end.join
end

Expand Down
4 changes: 2 additions & 2 deletions sig/lrama/grammar/percent_code.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ module Lrama
class Grammar
class PercentCode
attr_reader name: String
attr_reader code: Lexer::Token::UserCode
attr_reader code: String

def initialize: (String name, Lexer::Token::UserCode code) -> void
def initialize: (String name, String code) -> void
end
end
end

0 comments on commit 5a43cf2

Please sign in to comment.