def parse_belscript(lines):
nanopubs_metadata = {}<EOL>annotations = {}<EOL>assertions = []<EOL>line_num = <NUM_LIT:0><EOL>for line in set_single_line(lines):<EOL><INDENT>line_num += <NUM_LIT:1><EOL>line = re.sub("<STR_LIT>", "<STR_LIT>", line)<EOL>line = line.rstrip()<EOL>while re.search("<STR_LIT>", line):<EOL><INDENT>line = line.replace("<STR_LIT:\\>", "<STR_LIT>") + next(lines)<EOL><DEDENT>if re.match("<STR_LIT>", line) or re.match("<STR_LIT>", line):<EOL><INDENT>continue<EOL><DEDENT>elif re.match("<STR_LIT>", line):<EOL><INDENT>nanopubs_metadata = process_documentline(line, nanopubs_metadata)<EOL><DEDENT>elif re.match("<STR_LIT>", line):<EOL><INDENT>nanopubs_metadata = process_definition(line, nanopubs_metadata)<EOL><DEDENT>elif re.match("<STR_LIT>", line):<EOL><INDENT>if assertions:<EOL><INDENT>yield yield_nanopub(assertions, annotations, line_num)<EOL>assertions = []<EOL><DEDENT>annotations = process_unset(line, annotations)<EOL><DEDENT>elif re.match("<STR_LIT>", line):<EOL><INDENT>if nanopubs_metadata:<EOL><INDENT>yield yield_metadata(nanopubs_metadata)<EOL>nanopubs_metadata = {}<EOL><DEDENT>if assertions:<EOL><INDENT>yield yield_nanopub(assertions, annotations, line_num)<EOL>assertions = []<EOL><DEDENT>annotations = process_set(line, annotations)<EOL><DEDENT>else:<EOL><INDENT>assertions.append(line)<EOL><DEDENT><DEDENT>yield_nanopub(assertions, annotations, line_num)<EOL>
Lines from the BELScript - can be an iterator or list

    yields Nanopubs in nanopubs_bel-1.0.0 format