Skip to content

Commit

Permalink
Fix a warning for Ruby::UnannotatedEmptyCollection
Browse files Browse the repository at this point in the history
```
lib/lrama/lexer/token/user_code.rb:19:23: [warning] Empty array doesn't have type annotation
│ Diagnostic ID: Ruby::UnannotatedEmptyCollection
│
└           references = []
                         ~~
```
  • Loading branch information
ydah committed Dec 9, 2024
1 parent 79a8541 commit a904279
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions lib/lrama/lexer/token/user_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ def references

def _references
scanner = StringScanner.new(s_value)
references = []

until scanner.eos? do
case
when reference = scan_reference(scanner)
references << reference
when scanner.scan(/\/\*/)
scanner.scan_until(/\*\//)
else
scanner.getch
Enumerator.new do |y|
until scanner.eos?
case
when reference = scan_reference(scanner)
y << reference
when scanner.scan(/\/\*/)
scanner.scan_until(/\*\//)
else
scanner.getch
end
end
end

references
end.to_a
end

def scan_reference(scanner)
Expand Down

0 comments on commit a904279

Please sign in to comment.