(self, fors)
Get consecutive string-related formatting tokens.
Get consecutive string-related formatting tokens.
Get consecutive string - related formatting tokens .
def __init__(self, fors):
        """Get consecutive string-related formatting tokens."""
        word = b''
        c = fors.peek()
        if c in (b'!', b'&'):
            word += fors.read(1)
        elif c == b'\\':
            word += fors.read(1)
            # count the width of the \ \ token;
            # only spaces allowed and closing \ is necessary
            while True:
                c = fors.read(1)
                word += c
                if c == b'\\':
                    break
                elif c != b' ': # can be empty as well
                    fors.seek(-len(word), 1)
                    raise ValueError()
        if not word:
            raise ValueError()
        self._string_field = word
def __init__ ( self , fors ) : word = b'' c = fors . peek ( ) if c in ( b'!' , b'&' ) : word += fors . read ( 1 ) elif c == b'\\' : word += fors . read ( 1 ) # count the width of the \ \ token; # only spaces allowed and closing \ is necessary while True : c = fors . read ( 1 ) word += c if c == b'\\' : break elif c != b' ' : # can be empty as well fors . seek ( - len ( word ) , 1 ) raise ValueError ( ) if not word : raise ValueError ( ) self . _string_field = word