Module: EDNGRAMMAR::Map4

Defined in:
lib/parser/edngrammar.rb

Instance Method Summary collapse

Instance Method Details

#astObject



2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
# File 'lib/parser/edngrammar.rb', line 2198

def ast
  e = elements[1] # alternative
  ei = nil
  if e.respond_to?(:specms)
    if e.specms && e.specms.elements
      ei = e.specms.elements[1].text_value
    end
    r = Hash[ [e.keyp.ast] + e.elements[3].elements.map {|x| x.keyp.ast } ]
  else
    if e.spec && e.spec.elements
      ei = e.spec.elements[1].text_value
    end
    r = {}
  end
  if ei == ""
    r.cbor_stream!
  elsif ei
    warn "*** ignoring unimplemented encoding indicator #{ei.inspect} after ["
  end
  r
end