class AdLint::Cpp::Matcher
Public Class Methods
new(ptn_toks)
click to toggle source
# File lib/adlint/cpp/subst.rb, line 77 def initialize(ptn_toks) @state = OuterTokenMatching.new(self) @pattern_tokens = ptn_toks @pattern_index = 0 end
Public Instance Methods
accepted?()
click to toggle source
# File lib/adlint/cpp/subst.rb, line 108 def accepted? @state.accepted? end
match(toks, idx)
click to toggle source
# File lib/adlint/cpp/subst.rb, line 93 def match(toks, idx) return 0 if head = toks[idx] and head.type == :NEW_LINE match_len = 0 while tok = toks[idx] unless tok.type == :NEW_LINE @state = @state.process(tok) break unless @state.matching? end match_len += 1 idx += 1 end match_len end
matching?()
click to toggle source
# File lib/adlint/cpp/subst.rb, line 112 def matching? @state.matching? end
next_pattern_token()
click to toggle source
# File lib/adlint/cpp/subst.rb, line 87 def next_pattern_token ptn_tok = @pattern_tokens[@pattern_index] @pattern_index += 1 ptn_tok end
rejected?()
click to toggle source
# File lib/adlint/cpp/subst.rb, line 116 def rejected? @state.rejected? end
rest_pattern_tokens()
click to toggle source
# File lib/adlint/cpp/subst.rb, line 83 def rest_pattern_tokens @pattern_tokens.drop(@pattern_index) end