Skip to content
On this page

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class · Ruby 3.4

SyntaxSuggest::LeftRightLexCount

< Object 8 instance methods 1 class methods

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:

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
# => "}"

Class methods 1

Instance methods 8

Constants
No documentation available