Class: RegularExpression::Bytecode::Builder
- Inherits:
-
Object
- Object
- RegularExpression::Bytecode::Builder
- Defined in:
- lib/regular_expression/bytecode.rb
Instance Attribute Summary collapse
- #insns ⇒ Object readonly
-
#labels ⇒ Object
readonly
Hash[Symbol, Integer].
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #mark_label(label) ⇒ Object
- #push(*new_insns) ⇒ Object
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
143 144 145 146 |
# File 'lib/regular_expression/bytecode.rb', line 143 def initialize @insns = [] @labels = {} end |
Instance Attribute Details
#insns ⇒ Object (readonly)
140 141 142 |
# File 'lib/regular_expression/bytecode.rb', line 140 def insns @insns end |
#labels ⇒ Object (readonly)
Hash[Symbol, Integer]
141 142 143 |
# File 'lib/regular_expression/bytecode.rb', line 141 def labels @labels end |
Instance Method Details
#build ⇒ Object
156 157 158 |
# File 'lib/regular_expression/bytecode.rb', line 156 def build Compiled.new(insns, labels) end |
#mark_label(label) ⇒ Object
148 149 150 |
# File 'lib/regular_expression/bytecode.rb', line 148 def mark_label(label) labels[label] = insns.size end |
#push(*new_insns) ⇒ Object
152 153 154 |
# File 'lib/regular_expression/bytecode.rb', line 152 def push(*new_insns) insns.push(*new_insns) end |