Sha256: 05703d96cb5d83bfba27507c91b7d762779932d9de7ef990e29a2c0c7450b146
Contents?: true
Size: 972 Bytes
Versions: 1
Compression:
Stored size: 972 Bytes
Contents
# frozen_string_literal: true module Lrama class Grammar class ParameterizingRule class Rhs attr_accessor :symbols, :user_code, :precedence_sym def initialize @symbols = [] @user_code = nil @precedence_sym = nil end def resolve_user_code(bindings) return unless user_code resolved = Lexer::Token::UserCode.new(s_value: user_code.s_value, location: user_code.location) var_to_arg = {} symbols.each do |sym| resolved_sym = bindings.resolve_symbol(sym) if resolved_sym != sym var_to_arg[sym.s_value] = resolved_sym.s_value end end var_to_arg.each do |var, arg| resolved.references.each do |ref| if ref.name == var ref.name = arg end end end return resolved end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lrama-0.6.10 | lib/lrama/grammar/parameterizing_rule/rhs.rb |