commit b9b99b8

shrub  ·  2026-07-01 13:46:33 +0000 UTC
parent 3d6c1a2
allow computed variable named on lhs and add regression test for it
4 files changed,  +32, -2
+10, -2
 1@@ -64,6 +64,9 @@ astsplitwords(struct StrList *out, const char *s, size_t n);
 2 static void
 3 addrecipe_ast(struct RecipeList *dest, const char *raw);
 4 
 5+static int
 6+skipref(const char *s, size_t n, size_t *i);
 7+
 8 static void
 9 addwords_ast(struct StrList *dest, const struct StrList *src)
10 {
11@@ -123,9 +126,14 @@ iscondkw(const char *s)
12 static int
13 hasws(const char *s)
14 {
15-	size_t i;
16+	size_t i, n;
17 
18-	for (i = 0; s[i]; i++) {
19+	n = strlen(s);
20+	for (i = 0; i < n; i++) {
21+		if (s[i] == '$' && skipref(s, n, &i)) {
22+			i--;
23+			continue;
24+		}
25 		if (isspace((unsigned char)s[i]))
26 			return 1;
27 	}
+5, -0
1@@ -0,0 +1,5 @@
2+X = defs
3+TCCDEFS_H$(subst yes,,$(X)) = tccdefs_.h
4+
5+all:
6+	@echo $(TCCDEFS_Hdefs)
+1, -0
1@@ -0,0 +1 @@
2+tccdefs_.h
+16, -0
 1@@ -0,0 +1,16 @@
 2+{
 3+  "case": "t003",
 4+  "category": "variables",
 5+  "compare_output": true,
 6+  "description": "allow computed variable names on assignment lhs",
 7+  "details": "",
 8+  "env": {},
 9+  "expected_exit": 0,
10+  "options": "",
11+  "options_mode": "argv",
12+  "output_mode": "exact",
13+  "setup": [],
14+  "stdin": "",
15+  "suite": "shin",
16+  "timeout_seconds": 60
17+}