commit 1009bd4441675e1e50534c11e2e72f687a8ba902
parent c64fcd7214d08db9041cd4ddba67ea69e40f3562
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 Dec 2017 16:35:57 +0000
[as] Accept comments only at the beginning of field
This avoid problems with string and avoid the problems of parsing
before spliting.
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/as/parser.c b/as/parser.c
@@ -58,7 +58,11 @@ field(char **oldp, size_t *siz)
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 @@ extract(char *s, size_t len, struct line *lp)
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 @@ repeat:
}
buff[n-1] = '\0';
- if (p = memchr(buff, '#', n)) {
- *p = '\0';
- n = p - buff;
- }
if (extract(buff, n, lp) == 0)
goto repeat;
return 1;