shithub: tinygl

Download patch

ref: 87a5b7707035be4a72fc2a614c60226a934598fc
parent: be6b1c343dce770625a21fe57e9b1ef6677fa911
author: NAN <NAN>
date: Sat Jan 7 14:31:05 EST 2023

gitap from WSL2 on Main Machine

--- a/include-demo/stringutil.h
+++ b/include-demo/stringutil.h
@@ -523,76 +523,5 @@
 	return result;
 }
 
-static strll* parse_matched(strll* current_node, const char* tl, const char* tr){
-	strll* child_old; strll* right_old;
-	long current_tl_location; long counter = 1;
-	long current_tr_location; long start_tl_location;
-	long len_tl;
-	long len_tr;
-	len_tl = strlen(tl);
-	len_tr = strlen(tr);
-	current_tl_location = strfind(current_node->text, tl);
-	start_tl_location = current_tl_location;
-	current_tr_location = strfind(current_node->text, tr);
-	if(current_tr_location > -1 && 
-		current_tr_location < current_tl_location){
-		printf("\n<SYNTAX ERROR> %s before %s\n", tr, tl);
-		exit(1);
-	}
-	if(current_tr_location == -1 &&
-		current_tl_location != -1){
-		printf("\n<SYNTAX ERROR> You have a %s, but no matching %s ?", tl, tr);
-		exit(1);
-	}
-	/*We could not find a bracketed pair!*/
-	if(current_tl_location == -1){
-		return current_node;
-	}
-	child_old = current_node->child;
-	current_node->child = STRUTIL_CALLOC(1, sizeof(strll));
-	current_node->child->right = child_old;
-	right_old = current_node->right;
-	current_node->right = STRUTIL_CALLOC(1, sizeof(strll));
-	current_node->right->right = right_old;
-	/*Inch along, incrementing on*/
-	{ char* begin;long off = 0;
-		char* metaproc = current_node->text + current_tl_location + len_tl;
-		begin = metaproc;
-		current_tl_location = strfind(metaproc, tl);
-		current_tr_location = strfind(metaproc, tr);
-		while(counter > 0){
-			current_tl_location = strfind(metaproc, tl);
-			current_tr_location = strfind(metaproc, tr);
-			/*Handle the erroneous case- we cannot find tr.*/
-			if(current_tr_location == -1){
-				printf("\n<SYNTAX ERROR> Unmatched %s,%s group.\n", tl, tr);
-				exit(1);
-			}
-			if(current_tl_location != -1 &&
-			current_tl_location < current_tr_location){
-				off += current_tl_location + len_tl;
-				metaproc += current_tl_location + len_tl; counter++;
-			} else {
-				metaproc += current_tr_location + len_tr; counter--;
-				off += current_tr_location + len_tr;
-			}
-		}
-		if(counter < 0){
-			printf("\n<INTERNAL ERROR> Counter for %s,%s group somehow went negative.\n", tl, tr);
-			exit(1);
-		}
-		current_node->child->text = str_null_terminated_alloc(begin, off - len_tr);
-		{
-			char* text_old = current_node->text;
-			current_node->text = str_null_terminated_alloc(text_old, start_tl_location);
-			
-
-			/*Grab the post-text.*/
-			current_node->right->text = strcatalloc(begin + off, "");
-			free(text_old);
-		}
-	}
-	return current_node->child;
-}
 
 #endif