From 54d1af9b8830028c1a6a26da6751ace02cb69bbf Mon Sep 17 00:00:00 2001
From: anon <anon@anon.anon>
Date: Mon, 16 Dec 2024 00:44:50 +0100
Subject: [PATCH] fix(is_valid_c_sym)

---
 source/find.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/source/find.c b/source/find.c
index 082f924..290fd2a 100644
--- a/source/find.c
+++ b/source/find.c
@@ -699,14 +699,18 @@ void trim_trailing_ws(char *str, size_t len) {
 
 static inline
 bool is_valid_c_symbol(char *str) {
-	/* A symbol must start with an underscore or an alpha-numerical char */
-	if ((!isalpha((unsigned char)*str)) && (*str != '_')) {
+    /* C symbols are of the following pattern:
+     * [$_a-zA-Z][_a-zA-Z0-9]*
+     */
+	if ((!isalpha((unsigned char)*str))
+    &&  (*str != '_')
+    &&  (*str != '$')) {
 		return false;
 	}
 
-	/* Check whole string to ensure it is indeed all alpha and/or underscores */
 	while (*++str != '\0') {
-		if ((!isalpha((unsigned char)*str)) && (*str != '_')) {
+		if ((!isalnum((unsigned char)*str))
+        &&  (*str != '_')) {
 			return false;
 		}
 	}