Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tamouse
Created January 4, 2013 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamouse/4449464 to your computer and use it in GitHub Desktop.
Save tamouse/4449464 to your computer and use it in GitHub Desktop.
parsing some data in ruby
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"))
# -*- coding: utf-8 -*-
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*/)
puts "lval=#{lval}"
puts "rval=#{rval}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment