def parse_requirements(strs):
<EOL>lines = iter(yield_lines(strs))<EOL>def scan_list(ITEM,TERMINATOR,line,p,groups,item_name):<EOL><INDENT>items = []<EOL>while not TERMINATOR(line,p):<EOL><INDENT>if CONTINUE(line,p):<EOL><INDENT>try:<EOL><INDENT>line = next(lines); p = <NUM_LIT:0><EOL><DEDENT>except StopIteration:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT><DEDENT>match = ITEM(line,p)<EOL>if not match:<EOL><INDENT>raise ValueError("<STR_LIT>"+item_name+"<STR_LIT>",line,"<STR_LIT>",line[p:])<EOL><DEDENT>items.append(match.group(*groups))<EOL>p = match.end()<EOL>match = COMMA(line,p)<EOL>if match:<EOL><INDENT>p = match.end() <EOL><DEDENT>elif not TERMINATOR(line,p):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>",line,"<STR_LIT>",line[p:]<EOL>)<EOL><DEDENT><DEDENT>match = TERMINATOR(line,p)<EOL>if match: p = match.end()   <EOL>return line, p, items<EOL><DEDENT>for line in lines:<EOL><INDENT>match = DISTRO(line)<EOL>if not match:<EOL><INDENT>raise ValueError("<STR_LIT>", line)<EOL><DEDENT>project_name = match.group(<NUM_LIT:1>)<EOL>p = match.end()<EOL>extras = []<EOL>match = OBRACKET(line,p)<EOL>if match:<EOL><INDENT>p = match.end()<EOL>line, p, extras = scan_list(<EOL>DISTRO, CBRACKET, line, p, (<NUM_LIT:1>,), "<STR_LIT>"<EOL>)<EOL><DEDENT>line, p, specs = scan_list(VERSION,LINE_END,line,p,(<NUM_LIT:1>,<NUM_LIT:2>),"<STR_LIT>")<EOL>specs = [(op,safe_version(val)) for op,val in specs]<EOL>yield Requirement(project_name, specs, extras)<EOL><DEDENT>
Yield ``Requirement`` objects for each specification in `strs`

    `strs` must be an instance of ``basestring``, or a (possibly-nested)
    iterable thereof.