1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | // okay to copy/adapt
// can test this by itself!
void _append_element(Node** a_head, Node** a_tail, Element element) {
// standard append function
}
bool parse_list(Node** a_head, char const** a_pos) {
Node* head = NULL;
Node* tail = NULL;
// check for '['
// find a valid element using parse_element
// find a valid ','
// no second element, no ']'
if (some condition that makes the list invalid) {
// you can use free element to free up the list
Element list_element = {.type = ELEMENT_LIST, .as_list = head};
free_element(list_element);
return false;
}
// other stuff that makes the list valid instead
// check for ']'
*a_head = head;
return true;
}
|
© Copyright 2024 Alexander J. Quinn & David Burnett This content is protected and may not be shared, uploaded, or distributed.