开发者

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

开发者 https://www.devze.com 2023-02-07 14:07 出处:网络
The contents of the file looks like (any deep possible): { {bla: XBS/333: bla9,1-} } { {q: XBS/333: bla9,1-}

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)


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

0

精彩评论

暂无评论...
验证码 换一张
取 消