Skip to content

Commit

Permalink
Temple::Mixins::GrammarDSL - Add some missing match? methods
Browse files Browse the repository at this point in the history
  • Loading branch information
minad committed Aug 3, 2014
1 parent 7bc2ee5 commit 6891493
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/temple/mixins/grammar_dsl.rb
Expand Up @@ -7,6 +7,12 @@ def initialize(grammar)
@grammar = grammar
end

def match?(exp)
match(exp, [])
end
alias === match?
alias =~ match?

def |(rule)
Or.new(@grammar, self, rule)
end
Expand Down Expand Up @@ -53,10 +59,6 @@ def match(exp, unmatched)
success
end

def match?(exp)
match(exp, [])
end

def validate!(exp)
unmatched = []
unless match(exp, unmatched)
Expand Down Expand Up @@ -120,14 +122,13 @@ def extended(mod)
def match?(exp)
const_get(:Expression).match?(exp)
end
alias === match?
alias =~ match?

def validate!(exp)
const_get(:Expression).validate!(exp)
end

alias === match?
alias =~ match?

def Value(value)
Value.new(self, value)
end
Expand Down

0 comments on commit 6891493

Please sign in to comment.