aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/yacc.c
diff options
context:
space:
mode:
authorDan Cross <cross@gajendra.net>2017-04-20 21:35:23 +0000
committerRuss Cox <rsc@swtch.com>2017-04-21 14:09:47 +0000
commit9e52ea8a29db42f37188fd8fa35d641724c3d015 (patch)
treec09a7b1ac2d0b8ab98058f7e7fe5adaa0a29977b /src/cmd/yacc.c
parent94b38bdb722052838eb0d940c05995b870db4ea0 (diff)
downloadplan9port-9e52ea8a29db42f37188fd8fa35d641724c3d015.tar.gz
plan9port-9e52ea8a29db42f37188fd8fa35d641724c3d015.tar.bz2
plan9port-9e52ea8a29db42f37188fd8fa35d641724c3d015.zip
yacc: Fix a bug from at least 1995.
Fix a bug folding newlines in strings constants in C code snippets in YACC. This code has existed since at least 2nd Edition Plan 9. Change-Id: Iba17b89a6529ac9fa6610bf0b44f551904174c26 Signed-off-by: Dan Cross <cross@gajendra.net> Reviewed-on: https://plan9port-review.googlesource.com/2840 Reviewed-by: Russ Cox <rsc@swtch.com>
Diffstat (limited to 'src/cmd/yacc.c')
-rw-r--r--src/cmd/yacc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/yacc.c b/src/cmd/yacc.c
index c080e012..32990f62 100644
--- a/src/cmd/yacc.c
+++ b/src/cmd/yacc.c
@@ -2130,11 +2130,12 @@ swt:
c = Bgetrune(finput);
if(c == '\n')
lineno++;
- } else
+ } else {
if(c == match)
goto lcopy;
if(c == '\n')
error("newline in string or char. const.");
+ }
Bputrune(faction, c);
}
error("EOF in string or character constant");