about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/lex.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Src/lex.c b/Src/lex.c
index d88e57c22..e97762326 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1299,16 +1299,20 @@ dquote_parse(char endchar, int sub)
 		intick = 1, ALLOWHIST
 	    break;
 	case '(':
-	    pct++;
+	    if (!math || !bct)
+		pct++;
 	    break;
 	case ')':
-	    err = (!pct-- && math);
+	    if (!math || !bct)
+		err = (!pct-- && math);
 	    break;
 	case '[':
-	    brct++;
+	    if (!math || !bct)
+		brct++;
 	    break;
 	case ']':
-	    err = (!brct-- && math);
+	    if (!math || !bct)
+		err = (!brct-- && math);
 	    break;
 	case '"':
 	    if (intick || (!endchar && !bct))