class SyntaxSuggest::LeftRightLexCount

Find 根据词法计数查找不匹配的语法

用于检测缺失的元素对,每个关键字都需要一个 end,每个 '{' 都需要一个 '}' 等。

示例

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