Class: RPrec::DSL::PrecDSL
- Inherits:
-
Object
- Object
- RPrec::DSL::PrecDSL
- Defined in:
- lib/rprec/dsl.rb
Overview
PrecDSL
is a context of blocks of the RPrec::DSL#prec
method.
Instance Attribute Summary collapse
- #ops ⇒ Array<RPrec::Op> readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #closed(key, *parts, &build) ⇒ void
-
#initialize ⇒ PrecDSL
constructor
private
A new instance of PrecDSL.
- #left_assoc(key, *parts, &build) ⇒ void
- #non_assoc(key, *parts, &build) ⇒ void
- #non_assoc_postfix(key, *parts, &build) ⇒ void
- #non_assoc_prefix(key, *parts, &build) ⇒ void
- #postfix(key, *parts, &build) ⇒ void
- #prefix(key, *parts, &build) ⇒ void
- #right_assoc(key, *parts, &build) ⇒ void
Constructor Details
#initialize ⇒ PrecDSL
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 PrecDSL.
70 71 72 |
# File 'lib/rprec/dsl.rb', line 70 def initialize @ops = [] end |
Instance Attribute Details
#ops ⇒ Array<RPrec::Op> (readonly)
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.
78 79 80 |
# File 'lib/rprec/dsl.rb', line 78 def ops @ops end |
Class Method Details
.build(name, succs, &block) ⇒ RPrec::
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.
63 64 65 66 67 |
# File 'lib/rprec/dsl.rb', line 63 def self.build(name, succs, &block) context = PrecDSL.new context.instance_eval(&block) if block Prec.new(name, succs, context.ops) end |
Instance Method Details
#closed(key, *parts, &build) ⇒ void
This method returns an undefined value.
116 117 118 |
# File 'lib/rprec/dsl.rb', line 116 def closed(key, *parts, &build) @ops << Op.new(:closed, key, parts, build) end |
#left_assoc(key, *parts, &build) ⇒ void
This method returns an undefined value.
124 125 126 |
# File 'lib/rprec/dsl.rb', line 124 def left_assoc(key, *parts, &build) @ops << Op.new(:left_assoc, key, parts, build) end |
#non_assoc(key, *parts, &build) ⇒ void
This method returns an undefined value.
140 141 142 |
# File 'lib/rprec/dsl.rb', line 140 def non_assoc(key, *parts, &build) @ops << Op.new(:non_assoc, key, parts, build) end |
#non_assoc_postfix(key, *parts, &build) ⇒ void
This method returns an undefined value.
108 109 110 |
# File 'lib/rprec/dsl.rb', line 108 def non_assoc_postfix(key, *parts, &build) @ops << Op.new(:non_assoc_postfix, key, parts, build) end |
#non_assoc_prefix(key, *parts, &build) ⇒ void
This method returns an undefined value.
100 101 102 |
# File 'lib/rprec/dsl.rb', line 100 def non_assoc_prefix(key, *parts, &build) @ops << Op.new(:non_assoc_prefix, key, parts, build) end |
#postfix(key, *parts, &build) ⇒ void
This method returns an undefined value.
92 93 94 |
# File 'lib/rprec/dsl.rb', line 92 def postfix(key, *parts, &build) @ops << Op.new(:postfix, key, parts, build) end |