class AdLint::Cpp::Matcher::InnerAnyMatching

Public Class Methods

new(matcher, prv_state, depth) click to toggle source
Calls superclass method AdLint::Cpp::Matcher::State::new
# File lib/adlint/cpp/subst.rb, line 274
def initialize(matcher, prv_state, depth)
  super(matcher)
  @prv_state = prv_state
  @depth = depth
end

Public Instance Methods

process(tok) click to toggle source
# File lib/adlint/cpp/subst.rb, line 280
def process(tok)
  case tok.value
  when "(", "[", "{"
    @depth += 1
  when ")", "]", "}"
    @depth -= 1
  end

  if sentry_tok = rest_pattern_tokens.first
    if tok.value == sentry_tok.value
      if @depth < 0
        return @prv_state.process(tok)
      end
    end
  end
  self
end