shithub: scc

Download patch

ref: 0001a817076cbc01e7114c01a71fc1f70d6a4df5
parent: 9cdf8d4b4c9ecf24e8e065fdbf9a6aea48d5f4af
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Dec 12 11:35:57 EST 2017

[as] Accept comments only at the beginning of field

This avoid problems with string and avoid the problems of parsing
before spliting.

--- a/as/parser.c
+++ b/as/parser.c
@@ -58,7 +58,11 @@
 
 	if ((begin = *oldp) == NULL)
 		return NULL;
-	if (s = memchr(begin, '\t', *siz)) {
+
+	if (*begin == '/') {
+		*begin = '\0';
+		*oldp = NULL;
+	} if (s = memchr(begin, '\t', *siz)) {
 		*s++ = '\0';
 		*siz -= s - begin;
 		*oldp = s;
@@ -111,7 +115,7 @@
 	if (s) {
 		while (isspace(*s))
 			++s;
-		if (*s != '\0' && *s != ';')
+		if (*s != '\0' && *s != '/')
 			error("trailing characters at the end of the line");
 	}
 
@@ -141,10 +145,6 @@
 	}
 	buff[n-1] = '\0';
 
-	if (p = memchr(buff, '#', n)) {
-		*p = '\0';
-		n = p - buff;
-	}
 	if (extract(buff, n, lp) == 0)
 		goto repeat;
 	return 1;