Newer
Older
NewLang / src / parse.py
# SPDX-License-Identifier: LGPL-2.1-only
# Copyright 2022 Jookia <contact@jookia.org>

from src import tokenize


# Removes whitespace tokens
def remove_whitespace(tokens):
    output = []
    for t in tokens:
        if t.type not in [tokenize.TokenType.SPACE, tokenize.TokenType.NEWLINE]:
            output.append(t)
    return output