diff --git a/lib/lrama/grammar.rb b/lib/lrama/grammar.rb index 49f28b11..ecd9f375 100644 --- a/lib/lrama/grammar.rb +++ b/lib/lrama/grammar.rb @@ -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:) diff --git a/lib/lrama/output.rb b/lib/lrama/output.rb index 911177d2..936a3de8 100644 --- a/lib/lrama/output.rb +++ b/lib/lrama/output.rb @@ -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 diff --git a/sig/lrama/grammar/percent_code.rbs b/sig/lrama/grammar/percent_code.rbs index d154e18c..25d4653b 100644 --- a/sig/lrama/grammar/percent_code.rbs +++ b/sig/lrama/grammar/percent_code.rbs @@ -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