simpleparse.examples.biblioparser | index s:\sp\simpleparse\examples\biblioparser.py |
Example created in response to a question by Runsun Pan
This parses a simple line-oriented language where a section
in a bibliography-like system is denoted by sentinel values
which precede the section as the first characters of the
line.
Modules | ||||||
|
Data | ||
__file__ = r'S:\sp\simpleparse\examples\biblioparser.pyc' __name__ = 'simpleparse.examples.biblioparser' declaration = '\n\n<ts> := whitespace*\n<endoffile> := EOF\n\npaper ...e for every line...\n<sentinel> := (AU/TI/SO/AB)\n\n' line = ('line_content', 803, 811, []) paper = [('section', 1, 85, [('AU', 1, 3, None), ('line_content', 4, 77, []), ('line_content', 78, 84, [])]), ('section', 85, 264, [('TI', 85, 87, None), ('line_content', 88, 157, []), ('line_content', 158, 232, []), ('line_content', 233, 263, [])]), ('section', 264, 327, [('SO', 264, 266, None), ('line_content', 267, 326, [])]), ('section', 327, 435, [('AB', 327, 329, None), ('line_content', 330, 406, []), ('line_content', 407, 433, []), ('line_content', 434, 434, [])]), ('section', 435, 512, [('AU', 435, 437, None), ('line_content', 438, 508, []), ('line_content', 509, 511, [])]), ('section', 512, 592, [('TI', 512, 514, None), ('line_content', 515, 585, []), ('line_content', 586, 591, [])]), ('section', 592, 644, [('SO', 592, 594, None), ('line_content', 595, 643, [])]), ('section', 644, 812, [('AB', 644, 646, None), ('line_content', 647, 722, []), ('line_content', 723, 802, []), ('line_content', 803, 811, [])])] rest = [('line_content', 647, 722, []), ('line_content', 723, 802, []), ('line_content', 803, 811, [])] section = ('section', 644, 812, [('AB', 644, 646, None), ('line_content', 647, 722, []), ('line_content', 723, 802, []), ('line_content', 803, 811, [])]) testFile = '\nAU Chen Jiqiu; Kuhlencordt Peter J; Astern Josh...targeted deletion of the Cx43 gene were\nexamined\n' type = ('AB', 644, 646, None) |