Represents writing to a constant path.
::Foo = 1 ^^^^^^^^^ Foo::Bar = 1 ^^^^^^^^^^^^ ::Foo::Bar = 1 ^^^^^^^^^^^^^^
Represents using a trailing comma to indicate an implicit rest parameter.
foo { |bar,| } ^ foo in [bar,] ^ for foo, in bar do end ^ foo, = bar ^
Represents writing to an instance variable in a context that doesn’t have an explicit value.
@foo, @bar = baz ^^^^ ^^^^
Gem::StreamUI
implements a simple stream based user interface.
Find
mis-matched syntax based on lexical count
Used for detecting missing pairs of elements each keyword needs an end, each ‘{’ needs a ‘}’ etc.
Example:
left_right = LeftRightLexCount.new left_right.count_kw left_right.missing.first # => "end" left_right = LeftRightLexCount.new source = "{ a: b, c: d" # Note missing '}' LexAll.new(source: source).each do |lex| left_right.count_lex(lex) end left_right.missing.first # => "}"
Keeps track of what elements are in the queue in priority and also ensures that when one element engulfs/covers/eats another that the larger element evicts the smaller element
Holds elements in a priority heap on insert
Instead of constantly calling ‘sort!`, put the element where it belongs the first time around
Example:
queue = PriorityQueue.new queue << 33 queue << 44 queue << 1 puts queue.peek # => 44
Capture
parse errors from Ripper
Prism
returns the errors with their messages, but Ripper
does not. To get them we must make a custom subclass.
Example:
puts RipperErrors.new(" def foo").call.errors # => ["syntax error, unexpected end-of-input, expecting ';' or '\\n'"]
Used to construct C classes (CUnion
, CStruct
, etc)
Fiddle::Importer#struct
and Fiddle::Importer#union
wrap this functionality in an easy-to-use manner.
Helper methods for both Gem::Installer
and Gem::Uninstaller
A string field represents a string value on a node. It almost always represents the unescaped value of a string-like literal. It resolves to a string in Ruby.
Enumerator::ArithmeticSequence
is a subclass of Enumerator
, that is a representation of sequences of numbers with common difference. Instances of this class can be generated by the Range#step
and Numeric#step
methods.
The class can be used for slicing Array
(see Array#slice
) or custom collections.
This exception is raised if the nesting of parsed data structures is too deep.