lib/lrama/grammar/code/printer_code.rb in lrama-0.6.2 vs lib/lrama/grammar/code/printer_code.rb in lrama-0.6.3
- old
+ new
@@ -9,22 +9,28 @@
private
# * ($$) *yyvaluep
# * (@$) *yylocationp
+ # * ($:$) error
# * ($1) error
# * (@1) error
+ # * ($:1) error
def reference_to_c(ref)
case
when ref.type == :dollar && ref.name == "$" # $$
member = @tag.member
"((*yyvaluep).#{member})"
when ref.type == :at && ref.name == "$" # @$
"(*yylocationp)"
+ when ref.type == :index && ref.name == "$" # $:$
+ raise "$:#{ref.value} can not be used in #{type}."
when ref.type == :dollar # $n
raise "$#{ref.value} can not be used in #{type}."
when ref.type == :at # @n
raise "@#{ref.value} can not be used in #{type}."
+ when ref.type == :index # $:n
+ raise "$:#{ref.value} can not be used in #{type}."
else
raise "Unexpected. #{self}, #{ref}"
end
end
end