コード例 #1
0
def skip_white_lines(stream:CharacterStream, readtable:Readtable):
    while not stream.next_is_EOF():
        seq, properties = readtable.probe(stream)
        seq_type = properties.type
        if seq_type == RT.NEWLINE:
            continue
        if seq_type != RT.WHITESPACE:
            stream.unread_seq(seq)
            return
コード例 #2
0
def read_and_concatenate_constituent_sequences_ignore_isolation(stream:CharacterStream, readtable:Readtable):
    concatenation = ""
    while not stream.next_is_EOF():
        seq, properties = readtable.probe(stream)

        if properties.type == RT.CONSTITUENT or properties.type == RT.ISOLATED_CONSTITUENT:
            concatenation += seq
        else:
            stream.unread_seq(seq)
            return concatenation

    return concatenation