Minor cleanup.

This commit is contained in:
Simon Forman 2023-02-07 20:47:32 -08:00
parent efd77a2ffd
commit 94bcd2aa51
1 changed files with 19 additions and 32 deletions

View File

@ -79,27 +79,6 @@ my_callback(GC_PTR void_obj, __attribute__((unused)) GC_PTR void_environment) {
*/
JoyList
push_integer_from_str(char *str, JoyList tail)
{
JoyList el = newJoyList;
el->head = newJoyType;
el->head->kind = joyInt;
mpz_init_set_str(el->head->value.i, str, 10);
GC_register_finalizer(el->head->value.i, my_callback, NULL, NULL, NULL);
el->tail = tail;
return el;
}
char *
trim_leading_blanks(char *str)
{
size_t offset = strspn(str, BLANKS);
return (offset == strlen(str)) ? NULL : (str + offset);
}
JoyList
make_non_list_node(char *text, size_t size)
{
@ -229,17 +208,6 @@ pop_list(JoyListPtr stack)
}
void
push_quote_onto_expression(JoyList el, JoyListPtr expression)
{
JoyList node;
if (!el) return;
node = make_list_node(el);
node->tail = *expression;
*expression = node;
}
JoyList
newIntNode(void) {
JoyList node = newJoyList;
@ -361,6 +329,14 @@ print_stack(JoyList el)
*/
char *
trim_leading_blanks(char *str)
{
size_t offset = strspn(str, BLANKS);
return (offset == strlen(str)) ? NULL : (str + offset);
}
JoyList
parse_list(char **text)
{
@ -505,6 +481,17 @@ concatenating them.
*/
void
push_quote_onto_expression(JoyList el, JoyListPtr expression)
{
JoyList node;
if (!el) return;
node = make_list_node(el);
node->tail = *expression;
*expression = node;
}
JoyTypePtr
next_term(JoyListPtr expression)
{