Commit Diff


commit - 7252049dd77e4927049f698d06d7ebc8fbc3e3df
commit + bfb076ed7ee61a93cc6ae701b07c3d3bc7a006aa
blob - 00b37d0dd2efd91273b5b65b491bc97ff9eeb01d
blob + dfcfcd1d01db8631e631441dac5ca952b6256d79
--- gmid.1
+++ gmid.1
@@ -157,7 +157,7 @@ Macros can be defined that will later be expanded in c
 Macro names must start with a letter, digit or underscore and may
 contain any of those characters.
 Macro names may not be reserved words.
-Macros are expanded inside the quotes too.
+Macros are not expanded inside quotes.
 .Pp
 For example:
 .Bd -literal -offset indent
blob - 9b9b9dfa4b6cfeba4e1de078e11312b0673ec486
blob + 02ab8272bfbf564b3cfee0ac1ef66cb82dca3aa7
--- parse.y
+++ parse.y
@@ -416,7 +416,6 @@ repeat:
 		goto eof;
 	}
 
-top:
 	/* parsing next word */
 	for (;; c = getc(yyfp), yylval.colno++) {
 		switch (c) {
@@ -433,7 +432,7 @@ top:
 
 		/* expand macros in-place */
 		case '$':
-			if (!escape) {
+			if (!escape && !quotes) {
 				v = p;
 				while (1) {
 					if ((c = getc(yyfp)) == EOF) {
@@ -449,24 +448,24 @@ top:
 						continue;
 					}
 					*p = 0;
-					ungetc(c, yyfp);
 					break;
 				}
 				p = v;
 				if ((val = symget(p)) == NULL) {
 					yyerror("macro '%s' not defined", v);
-					goto top;
+					return TERR;
 				}
 				len = strlen(val);
 				if (p + len >= ebuf - 1) {
 					yyerror("after macro-expansion, "
 					    "string too long");
-					goto top;
+					return TERR;
 				}
 				*p = '\0';
 				strlcat(p, val, ebuf - p);
 				p += len;
-				goto top;
+				nonkw = 1;
+				goto eow;
 			}
 			break;
 		case '\n':