Class: Maccro::DSL::MatchExp

Inherits:
Node
  • Object
show all
Defined in:
lib/maccro/dsl/expression.rb

Instance Attribute Summary

Attributes inherited from Node

#first_column, #first_lineno, #last_column, #last_lineno, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#capture, #children, #initialize, #match?, #to_code_range

Methods included from ASTNodeWrapper

#capture, #children, #match?, #to_code_range

Constructor Details

This class inherits a constructor from Maccro::DSL::Node

Class Method Details

.match?(node) ⇒ Boolean

Returns:

  • (Boolean)


91
92
93
94
# File 'lib/maccro/dsl/expression.rb', line 91

def self.match?(node)
  t = node.type
  t == :MATCH || t == :MATCH2 || t == :MATCH3
end

Instance Method Details

#typeObject

MATCH: /…/ without ‘=~` (matches to $_ implicitly) MATCH2: /…/ =~ “…” (left side) MATCH3: “…” =~ /…/ (right side)



90
# File 'lib/maccro/dsl/expression.rb', line 90

def type; :MACCRO_MATCH; end