Created
January 4, 2013 02:39
-
-
Save tamouse/4449464 to your computer and use it in GitHub Desktop.
parsing some data in ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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