Пример #1
0
def group_into_tokens(characters):
    tokens = []
    next_index = 0

    while (next_index < len(characters)):

        token, next_index = get_token(characters, next_index)
        tokens.append(token)
    return tokens
Пример #2
0
def characters_to_nodes(characters):
    # global left_bracket_cnt
    length = len(characters)
    index = 0
    node_list = []
    while index < length:
        current_token, index = scan.get_token(characters, index)
        # 将token转化为node
        node = token_to_node(current_token)
        node_list.append(node)
    # modify_nodes(node_list)
    return node_list