class AdLint::Cpp::Matcher::InnerTokenMatching
Public Class Methods
new(matcher, prv_state)
click to toggle source
Calls superclass method
AdLint::Cpp::Matcher::State::new
# File lib/adlint/cpp/subst.rb, line 234 def initialize(matcher, prv_state) super(matcher) @prv_state = prv_state end
Public Instance Methods
process(tok)
click to toggle source
# File lib/adlint/cpp/subst.rb, line 239 def process(tok) if ptn_tok = next_pattern_token if tok.value == ptn_tok.value case tok.value when "(", "[", "{" InnerTokenMatching.new(matcher, self) when ")", "]", "}" @prv_state else self end else if ptn_tok.value == "__adlint__any" case tok.value when "(", "[", "{" InnerAnyMatching.new(matcher, self, 1) when ")", "]", "}" # NOTE: Return to the upper matching state and process the # current token in order not to discard it. @prv_state.process(tok) else InnerAnyMatching.new(matcher, self, 0) end else Rejected.new(matcher) end end else Accepted.new(matcher) end end