Class: Temple::Mixins::GrammarDSL::Rule Private

Inherits:
Object
  • Object
show all
Defined in:
lib/temple/mixins/grammar_dsl.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Direct Known Subclasses

Or, Value

Instance Method Summary collapse

Constructor Details

#initialize(grammar) ⇒ Rule

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Rule.



7
8
9
# File 'lib/temple/mixins/grammar_dsl.rb', line 7

def initialize(grammar)
  @grammar = grammar
end

Instance Method Details

#copy_to(grammar) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
24
25
# File 'lib/temple/mixins/grammar_dsl.rb', line 21

def copy_to(grammar)
  copy = dup.instance_eval { @grammar = grammar; self }
  copy.after_copy(self) if copy.respond_to?(:after_copy)
  copy
end

#match?(exp) ⇒ Boolean Also known as: ===, =~

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


11
12
13
# File 'lib/temple/mixins/grammar_dsl.rb', line 11

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

#|(rule) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
# File 'lib/temple/mixins/grammar_dsl.rb', line 17

def |(rule)
  Or.new(@grammar, self, rule)
end