package parser

import "../token"
import "core:strings"

is_table_separator :: proc(line: string) -> bool {
	inner := line[1:len(line) - 1]
	cells := strings.split(inner, "|", context.temp_allocator)
	if len(cells) == 0 {
		return false
	}
	for cell in cells {
		trimmed := strings.trim_space(cell)
		if len(trimmed) == 0 {
			return false
		}
		for ch in trimmed {
			if ch != '-' {
				return false
			}
		}
	}
	return true
}

parse_table_cells :: proc(line: string) -> []string {
	inner := line[1:len(line) - 1]
	cells := strings.split(inner, "|", context.temp_allocator)
	result := make([]string, len(cells), context.temp_allocator)
	for cell, i in cells {
		result[i] = strings.trim_space(cell)
	}
	return result
}
