#NEWLINE# def read_logic( s , logic_parser = None , encoding = None ) : #NEWLINE# #INDENT# '\n    Convert a file of First Order Formulas into a list of {Expression}s.\n\n    :param s: the contents of the file\n    :type s: str\n    :param logic_parser: The parser to be used to parse the logical expression\n    :type logic_parser: LogicParser\n    :param encoding: the encoding of the input string, if it is binary\n    :type encoding: str\n    :return: a list of parsed formulas.\n    :rtype: list(Expression)\n    ' #NEWLINE# if ( encoding is not None ) : #NEWLINE# #INDENT# s = s . decode ( encoding ) #NEWLINE# #UNINDENT# if ( logic_parser is None ) : #NEWLINE# #INDENT# logic_parser = LogicParser ( ) #NEWLINE# #UNINDENT# statements = [ ] #NEWLINE# for ( linenum , line ) in enumerate ( s . splitlines ( ) ) : #NEWLINE# #INDENT# line = line . strip ( ) #NEWLINE# if ( line . startswith ( '#' ) or ( line == '' ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# statements . append ( logic_parser . parse ( line ) ) #NEWLINE# #UNINDENT# except LogicalExpressionException : #NEWLINE# #INDENT# raise ValueError ( ( 'Unable to parse line %s: %s' % ( linenum , linenum ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return statements