Module: HGRAMMAR::AppStringH5
- Defined in:
- lib/cbor-diagnostic-app/hgrammar.rb
Instance Method Summary collapse
Instance Method Details
#ast ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/cbor-diagnostic-app/hgrammar.rb', line 68 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 && String === curr[0] curr.join # unpack_thread(curr) else CBOR::Tagged.new(888, (out << curr).map {|x| unpack_thread(x)}) end end |
#unpack_thread(s) ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/cbor-diagnostic-app/hgrammar.rb', line 58 def unpack_thread(s) case s[0] when CBOR::Tagged s[0] when String s.join else raise "@@@ unpack_thread #{s.inspect}" end end |