Module: Interscript::DSL::Items
Defined Under Namespace
Modules: Maps Classes: Map, Stages
Instance Method Summary collapse
- #any(*chars) ⇒ Object
-
#capture(expr) ⇒ Object
(…).
-
#map ⇒ Object
Implementation of ‘map.x`.
-
#maybe(*chars) ⇒ Object
a?.
- #maybe_some(*chars) ⇒ Object
- #method_missing(sym, *args, **kwargs, &block) ⇒ Object
-
#ref(int) ⇒ Object
1.
- #some(*chars) ⇒ Object
-
#stage ⇒ Object
Implementation of ‘stage.x`.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, **kwargs, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/interscript/dsl/items.rb', line 4 def method_missing sym, *args, **kwargs, &block super if args.length > 0 super if kwargs.length > 0 super if sym.to_s =~ /[?!=]\z/ super unless sym.to_s =~ /\A[\w\d]+\z/ super if block_given? Interscript::Node::Item::Alias.new(sym) end |
Instance Method Details
#any(*chars) ⇒ Object
14 15 16 17 |
# File 'lib/interscript/dsl/items.rb', line 14 def any(*chars) puts "any(#{chars.inspect}) from #{self.inspect}" if $DEBUG Interscript::Node::Item::Any.new(*chars) end |
#capture(expr) ⇒ Object
(…)
36 37 38 39 |
# File 'lib/interscript/dsl/items.rb', line 36 def capture(expr) puts "capture(#{expr.inspect}) from #{self.inspect}" if $DEBUG Interscript::Node::Item::CaptureGroup.new(expr) end |
#map ⇒ Object
Implementation of ‘map.x`
48 |
# File 'lib/interscript/dsl/items.rb', line 48 def map; Interscript::DSL::Items::Maps; end |
#maybe(*chars) ⇒ Object
a?
20 21 22 23 |
# File 'lib/interscript/dsl/items.rb', line 20 def maybe(*chars) puts "maybe(#{chars.inspect}) from #{self.inspect}" if $DEBUG Interscript::Node::Item::Maybe.new(*chars) end |
#maybe_some(*chars) ⇒ Object
25 26 27 28 |
# File 'lib/interscript/dsl/items.rb', line 25 def maybe_some(*chars) puts "maybe_some(#{chars.inspect}) from #{self.inspect}" if $DEBUG Interscript::Node::Item::MaybeSome.new(*chars) end |
#ref(int) ⇒ Object
1
42 43 44 45 |
# File 'lib/interscript/dsl/items.rb', line 42 def ref(int) puts "ref(#{int.inspect}) from #{self.inspect}" if $DEBUG Interscript::Node::Item::CaptureRef.new(int) end |
#some(*chars) ⇒ Object
30 31 32 33 |
# File 'lib/interscript/dsl/items.rb', line 30 def some(*chars) puts "some(#{chars.inspect}) from #{self.inspect}" if $DEBUG Interscript::Node::Item::Some.new(*chars) end |