Module: EDNGRAMMAR::SAppStringH6
- Defined in:
- lib/parser/edngrammar.rb
Instance Method Summary collapse
Instance Method Details
#ast ⇒ Object
8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 |
# File 'lib/parser/edngrammar.rb', line 8269 def ast e1 = elements[1].elements.map {|e| e.ast} out = [] curr = [] e1.each { |el| if curr.size == 0 || curr[0].class == el.class curr << el else out << curr curr = [el] end } if out.size == 0 && (curr.size == 0 || String === curr[0]) curr.join.b # unpack_thread(curr) else CBOR::Tagged.new(888, (out << curr).map {|x| unpack_thread(x)}) end end |
#unpack_thread(s) ⇒ Object
8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 |
# File 'lib/parser/edngrammar.rb', line 8259 def unpack_thread(s) case s[0] when CBOR::Tagged s[0] when String s.join else raise "@@@ unpack_thread #{s.inspect}" end end |