Search code examples
rubyparsingdata-structuresswift-mt

How do I parse a curly bracket structured file (e.g. Ruby)?


The contents of the file looks like (any deep possible):

{
  {bla: XBS/333: bla9,1-}
}
{
  {q: XBS/333: bla9,1-}
  {{}}
  {x:{t: QWA/333: C}}
}

How do I parse it to e.g. an Array or a Hash with Ruby? What do you think is a good data structure object to store it to?

(It's a SWIFT-Banking file, if that helps)


Solution

  • Try any proper parsers generator, for example http://treetop.rubyforge.org/