(self, ins, parse_file)
Parse PRINT or LPRINT syntax.
Parse PRINT or LPRINT syntax.
Parse PRINT or LPRINT syntax .
def _parse_print(self, ins, parse_file):
        """Parse PRINT or LPRINT syntax."""
        if parse_file:
            if ins.skip_blank_read_if((b'#',)):
                yield self.parse_expression(ins)
                ins.require_read((b',',))
            else:
                yield None
        while True:
            d = ins.skip_blank_read()
            if d in tk.END_STATEMENT:
                ins.seek(-len(d), 1)
                break
            elif d == tk.USING:
                yield (tk.USING, None)
                yield self.parse_expression(ins)
                ins.require_read((b';',))
                has_args = False
                while True:
                    expr = self.parse_expression(ins, allow_empty=True)
                    yield expr
                    if expr is None:
                        ins.require_end()
                        # need at least one argument after format string
                        if not has_args:
                            raise error.BASICError(error.MISSING_OPERAND)
                        break
                    has_args = True
                    if not ins.skip_blank_read_if((b';', b',')):
                        break
                break
            elif d in (b',', b';'):
                yield (d, None)
            elif d in (tk.SPC, tk.TAB):
                num = self.parse_expression(ins)
                ins.require_read((b')',))
                yield (d, num)
            else:
                ins.seek(-len(d), 1)
                yield (None, None)
                yield self.parse_expression(ins)
def _parse_print ( self , ins , parse_file ) : if parse_file : if ins . skip_blank_read_if ( ( b'#' , ) ) : yield self . parse_expression ( ins ) ins . require_read ( ( b',' , ) ) else : yield None while True : d = ins . skip_blank_read ( ) if d in tk . END_STATEMENT : ins . seek ( - len ( d ) , 1 ) break elif d == tk . USING : yield ( tk . USING , None ) yield self . parse_expression ( ins ) ins . require_read ( ( b';' , ) ) has_args = False while True : expr = self . parse_expression ( ins , allow_empty = True ) yield expr if expr is None : ins . require_end ( ) # need at least one argument after format string if not has_args : raise error . BASICError ( error . MISSING_OPERAND ) break has_args = True if not ins . skip_blank_read_if ( ( b';' , b',' ) ) : break break elif d in ( b',' , b';' ) : yield ( d , None ) elif d in ( tk . SPC , tk . TAB ) : num = self . parse_expression ( ins ) ins . require_read ( ( b')' , ) ) yield ( d , num ) else : ins . seek ( - len ( d ) , 1 ) yield ( None , None ) yield self . parse_expression ( ins )