Class: Kotoshu::Grammar::PatternMatchers::BaseMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/kotoshu/grammar/pattern_matchers/base_matcher.rb

Overview

Base class for pattern matchers.

Pattern matchers check token sequences against specific patterns defined in YAML configuration.

Instance Method Summary collapse

Constructor Details

#initialize(pattern, exceptions = {}) ⇒ BaseMatcher

Returns a new instance of BaseMatcher.



11
12
13
14
# File 'lib/kotoshu/grammar/pattern_matchers/base_matcher.rb', line 11

def initialize(pattern, exceptions = {})
  @pattern = pattern
  @exceptions = exceptions
end

Instance Method Details

#match(tokens, rule) ⇒ Array<Hash>

Match tokens against the pattern.

Parameters:

  • tokens (Array<Hash>)

    Array of token hashes

  • rule (Rule)

    The rule being checked

Returns:

  • (Array<Hash>)

    Array of error hashes



21
22
23
# File 'lib/kotoshu/grammar/pattern_matchers/base_matcher.rb', line 21

def match(tokens, rule)
  []
end