From b0e2611cddc9e6a729e939984ff912b1d14a3480 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Wed, 14 Feb 2024 21:30:48 +0900 Subject: [PATCH] `#scan_reference` should fill `Reference#number` for `$:n`. Follow up of bf072d0. --- lib/lrama/lexer/token/user_code.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lrama/lexer/token/user_code.rb b/lib/lrama/lexer/token/user_code.rb index 5836f6ee..14c69f3d 100644 --- a/lib/lrama/lexer/token/user_code.rb +++ b/lib/lrama/lexer/token/user_code.rb @@ -61,7 +61,7 @@ def scan_reference(scanner) when scanner.scan(/\$:\$/) # $:$ return Lrama::Grammar::Reference.new(type: :index, name: "$", first_column: start, last_column: scanner.pos) when scanner.scan(/\$:(\d+)/) # $:1 - return Lrama::Grammar::Reference.new(type: :index, index: Integer(scanner[1]), first_column: start, last_column: scanner.pos) + return Lrama::Grammar::Reference.new(type: :index, number: Integer(scanner[1]), first_column: start, last_column: scanner.pos) when scanner.scan(/\$:([a-zA-Z_][a-zA-Z0-9_]*)/) # $:foo, $:expr (named reference without brackets) return Lrama::Grammar::Reference.new(type: :index, name: scanner[1], first_column: start, last_column: scanner.pos) when scanner.scan(/\$:\[([a-zA-Z_.][-a-zA-Z0-9_.]*)\]/) # $:[expr.right], $:[expr-right] (named reference with brackets)