On Thu, Jan 3, 2013 at 6:16 PM, Wayne Brissette <wbrisett / att.net> wrote:
> On Jan 3, 2013, at 3:23 PM, Matma Rex wrote:
>> On Thu, 03 Jan 2013 22:13:14 +0100, Wayne Brissette <wbrisett / att.net> wrote:
>>> Normally I would use read in the file, assign it to a variable and thenuse someVariable.split(" insFld(foldersTree,")
>>> However, in this case I want everything from the beginning of that linetoo. Any ideas? Maybe a different way to parse this data?

Something like this?

data = <<-EOF
 addrmap_ntimc0 = insFld(foldersTree, gFld("ntimc0 @0x0.0x0.0x0",
"ntimc0_doc.html#addrmap_ntimc0"))
    addrmap_ntimc0_ntimc_core = insFld(addrmap_ntimc0,
gFld("ntimc_core @0x0.0x0.0x0",
"ntimc0_doc.html#addrmap_ntimc0_ntimc_core"))
      reg_ntimc0_ntimc_core_CFG = insDoc(addrmap_ntimc0_ntimc_core,
gLnk("R", "CFG @0x0.0x0.0x0",
"ntimc0_doc.html#reg_ntimc0_ntimc_core_CFG"))
กฤ
  addrmap_ntimc1 = insFld(foldersTree, gFld("ntimc1 @0x1.0x0.0x0",
"ntimc1_doc.html#addrmap_ntimc1"))
    addrmap_ntimc1_ntimc_core = insFld(addrmap_ntimc1,
gFld("ntimc_core @0x1.0x0.0x0",
"ntimc1_doc.html#addrmap_ntimc1_ntimc_core"))
      reg_ntimc1_ntimc_core_CFG = insDoc(addrmap_ntimc1_ntimc_core,
gLnk("R", "CFG @0x1.0x0.0x0",
"ntimc1_doc.html#reg_ntimc1_ntimc_core_CFG"))
EOF

data.lines.each do |l|
  (lval,rval) = l.strip.split(/\s*=\s*/)
  p "lval=#{lval}"
  p "rval=#{rval}"

end

output:

lval=addrmap_ntimc0
rval=insFld(foldersTree, gFld("ntimc0 @0x0.0x0.0x0",
"ntimc0_doc.html#addrmap_ntimc0"))
lval=addrmap_ntimc0_ntimc_core
rval=insFld(addrmap_ntimc0, gFld("ntimc_core @0x0.0x0.0x0",
"ntimc0_doc.html#addrmap_ntimc0_ntimc_core"))
lval=reg_ntimc0_ntimc_core_CFG
rval=insDoc(addrmap_ntimc0_ntimc_core, gLnk("R", "CFG @0x0.0x0.0x0",
"ntimc0_doc.html#reg_ntimc0_ntimc_core_CFG"))
lval=กฤ
rval=
lval=addrmap_ntimc1
rval=insFld(foldersTree, gFld("ntimc1 @0x1.0x0.0x0",
"ntimc1_doc.html#addrmap_ntimc1"))
lval=addrmap_ntimc1_ntimc_core
rval=insFld(addrmap_ntimc1, gFld("ntimc_core @0x1.0x0.0x0",
"ntimc1_doc.html#addrmap_ntimc1_ntimc_core"))
lval=reg_ntimc1_ntimc_core_CFG
rval=insDoc(addrmap_ntimc1_ntimc_core, gLnk("R", "CFG @0x1.0x0.0x0",
"ntimc1_doc.html#reg_ntimc1_ntimc_core_CFG"))


(gmail's line folding will probably mess that up, so here's a gist:
https://gist.github.com/4449464)