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.
65 66 67 |
# File 'lib/rprec/dsl.rb', line 65 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.
73 74 75 |
# File 'lib/rprec/dsl.rb', line 73 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.
58 59 60 61 62 |
# File 'lib/rprec/dsl.rb', line 58 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.
111 112 113 |
# File 'lib/rprec/dsl.rb', line 111 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.
119 120 121 |
# File 'lib/rprec/dsl.rb', line 119 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.
135 136 137 |
# File 'lib/rprec/dsl.rb', line 135 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.
103 104 105 |
# File 'lib/rprec/dsl.rb', line 103 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.
95 96 97 |
# File 'lib/rprec/dsl.rb', line 95 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.
87 88 89 |
# File 'lib/rprec/dsl.rb', line 87 def postfix(key, *parts, &build) @ops << Op.new(:postfix, key, parts, build) end |