有什么方法可以找到索引rule(:group) {
(
str("{") >>
newline.maybe >>
content >>
newline.maybe >>
str("}")
).as(:group)
}
处的元素为空还是不像矢量++和数组中的C ++中的{:header=>
{:rtf=>{:version=>"1"@5},
:charset=>"ansi"@7,
:deff=>"\\deff3"@11,
:color_table=>nil},
:document=>
[{:control_word=>{:word=>"adeflang"@18, :delimiter=>"1025"@26}},
{:control_word=>{:word=>"n"@31, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"fonttbl"@34, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"f"@43, :delimiter=>"0"@44}},
{:control_word=>{:word=>"froman"@46, :delimiter=>nil}},
{:control_word=>{:word=>"fprq"@53, :delimiter=>"2"@57}},
{:control_word=>{:word=>"fcharset"@59, :delimiter=>"0"@67}},
{:text=>" Times New Roman;"@68}]},
{:group=>
[{:control_word=>{:word=>"f"@88, :delimiter=>"1"@89}},
{:control_word=>{:word=>"froman"@91, :delimiter=>nil}},
{:control_word=>{:word=>"fprq"@98, :delimiter=>"2"@102}},
{:control_word=>{:word=>"fcharset"@104, :delimiter=>"2"@112}},
{:text=>" Symbol;"@113}]},
{:group=>
[{:control_word=>{:word=>"f"@124, :delimiter=>"2"@125}},
{:control_word=>{:word=>"fswiss"@127, :delimiter=>nil}},
{:control_word=>{:word=>"fprq"@134, :delimiter=>"2"@138}},
{:control_word=>{:word=>"fcharset"@140, :delimiter=>"0"@148}},
{:text=>" Arial;"@149}]},
{:group=>
[{:control_word=>{:word=>"f"@159, :delimiter=>"3"@160}},
{:control_word=>{:word=>"froman"@162, :delimiter=>nil}},
{:control_word=>{:word=>"fprq"@169, :delimiter=>"2"@173}},
{:control_word=>{:word=>"fcharset"@175, :delimiter=>"128"@183}},
{:text=>" Times New Roman;"@186}]},
{:group=>
[{:control_word=>{:word=>"f"@206, :delimiter=>"4"@207}},
{:control_word=>{:word=>"fswiss"@209, :delimiter=>nil}},
{:control_word=>{:word=>"fprq"@216, :delimiter=>"2"@220}},
{:control_word=>{:word=>"fcharset"@222, :delimiter=>"128"@230}},
{:text=>" Arial;"@233}]},
{:group=>
[{:control_word=>{:word=>"f"@243, :delimiter=>"5"@244}},
{:control_word=>{:word=>"fnil"@246, :delimiter=>nil}},
{:control_word=>{:word=>"fprq"@251, :delimiter=>"2"@255}},
{:control_word=>{:word=>"fcharset"@257, :delimiter=>"128"@265}},
{:text=>" Droid Sans Fallback;"@268}]},
{:group=>
[{:control_word=>{:word=>"f"@292, :delimiter=>"6"@293}},
{:control_word=>{:word=>"fnil"@295, :delimiter=>nil}},
{:control_word=>{:word=>"fprq"@300, :delimiter=>"2"@304}},
{:control_word=>{:word=>"fcharset"@306, :delimiter=>"128"@314}},
{:text=>" DejaVu Sans;"@317}]},
{:group=>
[{:control_word=>{:word=>"f"@333, :delimiter=>"7"@334}},
{:control_word=>{:word=>"fswiss"@336, :delimiter=>nil}},
{:control_word=>{:word=>"fprq"@343, :delimiter=>"0"@347}},
{:control_word=>{:word=>"fcharset"@349, :delimiter=>"128"@357}},
{:text=>" DejaVu Sans;"@360}]}]},
{:control_word=>{:word=>"n"@376, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"colortbl"@379, :delimiter=>";"@387}},
{:control_word=>{:word=>"red"@389, :delimiter=>"0"@392}},
{:control_word=>{:word=>"green"@394, :delimiter=>"0"@399}},
{:control_word=>{:word=>"blue"@401, :delimiter=>"0"@405}},
{:text=>";"@406},
{:control_word=>{:word=>"red"@408, :delimiter=>"128"@411}},
{:control_word=>{:word=>"green"@415, :delimiter=>"128"@420}},
{:control_word=>{:word=>"blue"@424, :delimiter=>"128"@428}},
{:text=>";"@431}]},
{:control_word=>{:word=>"n"@434, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"stylesheet"@437, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"s"@449, :delimiter=>"0"@450}},
{:control_word=>{:word=>"snext"@452, :delimiter=>"0"@457}},
{:control_word=>{:word=>"nowidctlpar"@459, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>[], :delimiter=>nil}},
{:text=>"*"@472},
{:control_word=>{:word=>"hyphen"@474, :delimiter=>"2"@480}},
{:control_word=>{:word=>"hyphlead"@482, :delimiter=>"2"@490}},
{:control_word=>{:word=>"hyphtrail"@492, :delimiter=>"2"@501}},
{:control_word=>{:word=>"hyphmax"@503, :delimiter=>"0"@510}}]},
{:control_word=>{:word=>"cf"@513, :delimiter=>"0"@515}},
{:control_word=>{:word=>"kerning"@517, :delimiter=>"1"@524}},
{:control_word=>{:word=>"hich"@526, :delimiter=>nil}},
{:control_word=>{:word=>"af"@531, :delimiter=>"5"@533}},
{:control_word=>{:word=>"langfe"@535, :delimiter=>"2052"@541}},
{:control_word=>{:word=>"dbch"@546, :delimiter=>nil}},
{:control_word=>{:word=>"af"@551, :delimiter=>"6"@553}},
{:control_word=>{:word=>"afs"@555, :delimiter=>"24"@558}},
{:control_word=>{:word=>"lang"@561, :delimiter=>"1081"@565}},
{:control_word=>{:word=>"loch"@570, :delimiter=>nil}},
{:control_word=>{:word=>"f"@575, :delimiter=>"3"@576}},
{:control_word=>{:word=>"fs"@578, :delimiter=>"24"@580}},
{:control_word=>{:word=>"lang"@583, :delimiter=>"1033"@587}},
{:text=>" Default;"@591}]},
{:control_word=>{:word=>"n"@602, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"s"@605, :delimiter=>"15"@606}},
{:control_word=>{:word=>"sbasedon"@609, :delimiter=>"0"@617}},
{:control_word=>{:word=>"snext"@619, :delimiter=>"16"@624}},
{:control_word=>{:word=>"sb"@627, :delimiter=>"240"@629}},
{:control_word=>{:word=>"sa"@633, :delimiter=>"120"@635}},
{:control_word=>{:word=>"keepn"@639, :delimiter=>nil}},
{:control_word=>{:word=>"hich"@645, :delimiter=>nil}},
{:control_word=>{:word=>"af"@650, :delimiter=>"5"@652}},
{:control_word=>{:word=>"dbch"@654, :delimiter=>nil}},
{:control_word=>{:word=>"af"@659, :delimiter=>"6"@661}},
{:control_word=>{:word=>"afs"@663, :delimiter=>"28"@666}},
{:control_word=>{:word=>"loch"@669, :delimiter=>nil}},
{:control_word=>{:word=>"f"@674, :delimiter=>"4"@675}},
{:control_word=>{:word=>"fs"@677, :delimiter=>"28"@679}},
{:text=>" Heading;"@681}]},
{:control_word=>{:word=>"n"@692, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"s"@695, :delimiter=>"16"@696}},
{:control_word=>{:word=>"sbasedon"@699, :delimiter=>"0"@707}},
{:control_word=>{:word=>"snext"@709, :delimiter=>"16"@714}},
{:control_word=>{:word=>"sb"@717, :delimiter=>"0"@719}},
{:control_word=>{:word=>"sa"@721, :delimiter=>"120"@723}},
{:text=>" Text body;"@726}]},
{:control_word=>{:word=>"n"@739, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"s"@742, :delimiter=>"17"@743}},
{:control_word=>{:word=>"sbasedon"@746, :delimiter=>"16"@754}},
{:control_word=>{:word=>"snext"@757, :delimiter=>"17"@762}},
{:control_word=>{:word=>"sb"@765, :delimiter=>"0"@767}},
{:control_word=>{:word=>"sa"@769, :delimiter=>"120"@771}},
{:control_word=>{:word=>"dbch"@775, :delimiter=>nil}},
{:control_word=>{:word=>"af"@780, :delimiter=>"7"@782}},
{:text=>" List;"@783}]},
{:control_word=>{:word=>"n"@791, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"s"@794, :delimiter=>"18"@795}},
{:control_word=>{:word=>"sbasedon"@798, :delimiter=>"0"@806}},
{:control_word=>{:word=>"snext"@808, :delimiter=>"18"@813}},
{:control_word=>{:word=>"sb"@816, :delimiter=>"120"@818}},
{:control_word=>{:word=>"sa"@822, :delimiter=>"120"@824}},
{:control_word=>{:word=>"noline"@828, :delimiter=>nil}},
{:control_word=>{:word=>"i"@835, :delimiter=>nil}},
{:control_word=>{:word=>"dbch"@837, :delimiter=>nil}},
{:control_word=>{:word=>"af"@842, :delimiter=>"7"@844}},
{:control_word=>{:word=>"afs"@846, :delimiter=>"24"@849}},
{:control_word=>{:word=>"ai"@852, :delimiter=>nil}},
{:control_word=>{:word=>"fs"@855, :delimiter=>"24"@857}},
{:text=>" Caption;"@859}]},
{:control_word=>{:word=>"n"@870, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"s"@873, :delimiter=>"19"@874}},
{:control_word=>{:word=>"sbasedon"@877, :delimiter=>"0"@885}},
{:control_word=>{:word=>"snext"@887, :delimiter=>"19"@892}},
{:control_word=>{:word=>"noline"@895, :delimiter=>nil}},
{:control_word=>{:word=>"dbch"@902, :delimiter=>nil}},
{:control_word=>{:word=>"af"@907, :delimiter=>"7"@909}},
{:text=>" Index;"@910}]},
{:control_word=>{:word=>"n"@919, :delimiter=>nil}}]},
{:group=>
[{:control_word=>{:word=>"info"@923, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"creatim"@929, :delimiter=>nil}},
{:control_word=>{:word=>"yr"@937, :delimiter=>"2018"@939}},
{:control_word=>{:word=>"mo"@944, :delimiter=>"7"@946}},
{:control_word=>{:word=>"dy"@948, :delimiter=>"15"@950}},
{:control_word=>{:word=>"hr"@953, :delimiter=>"11"@955}},
{:control_word=>{:word=>"min"@958, :delimiter=>"52"@961}}]},
{:group=>
[{:control_word=>{:word=>"revtim"@966, :delimiter=>nil}},
{:control_word=>{:word=>"yr"@973, :delimiter=>"0"@975}},
{:control_word=>{:word=>"mo"@977, :delimiter=>"0"@979}},
{:control_word=>{:word=>"dy"@981, :delimiter=>"0"@983}},
{:control_word=>{:word=>"hr"@985, :delimiter=>"0"@987}},
{:control_word=>{:word=>"min"@989, :delimiter=>"0"@992}}]},
{:group=>
[{:control_word=>{:word=>"printim"@996, :delimiter=>nil}},
{:control_word=>{:word=>"yr"@1004, :delimiter=>"0"@1006}},
{:control_word=>{:word=>"mo"@1008, :delimiter=>"0"@1010}},
{:control_word=>{:word=>"dy"@1012, :delimiter=>"0"@1014}},
{:control_word=>{:word=>"hr"@1016, :delimiter=>"0"@1018}},
{:control_word=>{:word=>"min"@1020, :delimiter=>"0"@1023}}]},
{:group=>
[{:control_word=>{:word=>"comment"@1027, :delimiter=>" "@1034}},
{:text=>"OpenOffice"@1035}]},
{:group=>
[{:control_word=>{:word=>"vern"@1048, :delimiter=>"4140"@1052}}]}]},
{:control_word=>{:word=>"deftab"@1059, :delimiter=>"709"@1065}},
{:control_word=>{:word=>"n"@1069, :delimiter=>nil}},
{:control_word=>{:word=>"n"@1071, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>[], :delimiter=>nil}},
{:text=>"*"@1074},
{:control_word=>{:word=>"pgdsctbl"@1076, :delimiter=>nil}},
{:control_word=>{:word=>"n"@1085, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>"pgdsc"@1088, :delimiter=>"0"@1093}},
{:control_word=>{:word=>"pgdscuse"@1095, :delimiter=>"195"@1103}},
{:control_word=>{:word=>"pgwsxn"@1107, :delimiter=>"12240"@1113}},
{:control_word=>{:word=>"pghsxn"@1119, :delimiter=>"15840"@1125}},
{:control_word=>{:word=>"marglsxn"@1131, :delimiter=>"1134"@1139}},
{:control_word=>{:word=>"margrsxn"@1144, :delimiter=>"1134"@1152}},
{:control_word=>{:word=>"margtsxn"@1157, :delimiter=>"1134"@1165}},
{:control_word=>{:word=>"margbsxn"@1170, :delimiter=>"1134"@1178}},
{:control_word=>{:word=>"pgdscnxt"@1183, :delimiter=>"0"@1191}},
{:text=>" Default;"@1192}]}]},
{:control_word=>{:word=>"n"@1204, :delimiter=>nil}},
{:control_word=>{:word=>"formshade"@1206, :delimiter=>nil}},
{:control_word=>{:word=>"paperh"@1216, :delimiter=>"15840"@1222}},
{:control_word=>{:word=>"paperw"@1228, :delimiter=>"12240"@1234}},
{:control_word=>{:word=>"margl"@1240, :delimiter=>"1134"@1245}},
{:control_word=>{:word=>"margr"@1250, :delimiter=>"1134"@1255}},
{:control_word=>{:word=>"margt"@1260, :delimiter=>"1134"@1265}},
{:control_word=>{:word=>"margb"@1270, :delimiter=>"1134"@1275}},
{:control_word=>{:word=>"sectd"@1280, :delimiter=>nil}},
{:control_word=>{:word=>"sbknone"@1286, :delimiter=>nil}},
{:control_word=>{:word=>"sectunlocked"@1294, :delimiter=>"1"@1306}},
{:control_word=>{:word=>"pgndec"@1308, :delimiter=>nil}},
{:control_word=>{:word=>"pgwsxn"@1315, :delimiter=>"12240"@1321}},
{:control_word=>{:word=>"pghsxn"@1327, :delimiter=>"15840"@1333}},
{:control_word=>{:word=>"marglsxn"@1339, :delimiter=>"1134"@1347}},
{:control_word=>{:word=>"margrsxn"@1352, :delimiter=>"1134"@1360}},
{:control_word=>{:word=>"margtsxn"@1365, :delimiter=>"1134"@1373}},
{:control_word=>{:word=>"margbsxn"@1378, :delimiter=>"1134"@1386}},
{:control_word=>{:word=>"ftnbj"@1391, :delimiter=>nil}},
{:control_word=>{:word=>"ftnstart"@1397, :delimiter=>"1"@1405}},
{:control_word=>{:word=>"ftnrstcont"@1407, :delimiter=>nil}},
{:control_word=>{:word=>"ftnnar"@1418, :delimiter=>nil}},
{:control_word=>{:word=>"aenddoc"@1425, :delimiter=>nil}},
{:control_word=>{:word=>"aftnrstcont"@1433, :delimiter=>nil}},
{:control_word=>{:word=>"aftnstart"@1445, :delimiter=>"1"@1454}},
{:control_word=>{:word=>"aftnnrlc"@1456, :delimiter=>nil}},
{:control_word=>{:word=>"n"@1465, :delimiter=>nil}},
{:control_word=>{:word=>"pgndec"@1467, :delimiter=>nil}},
{:control_word=>{:word=>"pard"@1474, :delimiter=>nil}},
{:control_word=>{:word=>"plain"@1479, :delimiter=>" "@1484}},
{:control_word=>{:word=>"s"@1486, :delimiter=>"0"@1487}},
{:control_word=>{:word=>"nowidctlpar"@1489, :delimiter=>nil}},
{:group=>
[{:control_word=>{:word=>[], :delimiter=>nil}},
{:text=>"*"@1502},
{:control_word=>{:word=>"hyphen"@1504, :delimiter=>"2"@1510}},
{:control_word=>{:word=>"hyphlead"@1512, :delimiter=>"2"@1520}},
{:control_word=>{:word=>"hyphtrail"@1522, :delimiter=>"2"@1531}},
{:control_word=>{:word=>"hyphmax"@1533, :delimiter=>"0"@1540}}]},
{:control_word=>{:word=>"cf"@1543, :delimiter=>"0"@1545}},
{:control_word=>{:word=>"kerning"@1547, :delimiter=>"1"@1554}},
{:control_word=>{:word=>"hich"@1556, :delimiter=>nil}},
{:control_word=>{:word=>"af"@1561, :delimiter=>"5"@1563}},
{:control_word=>{:word=>"langfe"@1565, :delimiter=>"2052"@1571}},
{:control_word=>{:word=>"dbch"@1576, :delimiter=>nil}},
{:control_word=>{:word=>"af"@1581, :delimiter=>"6"@1583}},
{:control_word=>{:word=>"afs"@1585, :delimiter=>"24"@1588}},
{:control_word=>{:word=>"lang"@1591, :delimiter=>"1081"@1595}},
{:control_word=>{:word=>"loch"@1600, :delimiter=>nil}},
{:control_word=>{:word=>"f"@1605, :delimiter=>"3"@1606}},
{:control_word=>{:word=>"fs"@1608, :delimiter=>"24"@1610}},
{:control_word=>{:word=>"lang"@1613, :delimiter=>"1033"@1617}},
{:group=>
[{:control_word=>{:word=>"rtlch"@1623, :delimiter=>" "@1628}},
{:control_word=>{:word=>"ltrch"@1630, :delimiter=>nil}},
{:control_word=>{:word=>"loch"@1636, :delimiter=>nil}},
{:control_word=>{:word=>"n"@1641, :delimiter=>nil}},
{:text=>"I like to read."@1642}]},
{:control_word=>{:word=>"n"@1659, :delimiter=>nil}},
{:control_word=>{:word=>"par"@1661, :delimiter=>" "@1664}}]}
函数一样
1)获取数组或向量中的元素i
和
2)检查是否为空
对于整数