Honor a semicolon on the same line as an ending token of a heredoc

This commit is contained in:
Zeev Suraski 1999-04-09 11:19:03 +00:00
parent 0a6e9ddd7f
commit 43c0e94ac9

View File

@ -1010,16 +1010,27 @@ TLS_VARS;
}
<HEREDOC>^{LABEL}("\r")?"\n" {
<HEREDOC>^{LABEL}(";")?("\r")?"\n" {
int label_len;
unsigned char unput_semicolon;
if (yytext[yyleng-2]=='\r') {
label_len = yyleng-2;
} else {
label_len = yyleng-1;
}
if (yytext[label_len-1]==';') {
label_len--;
unput_semicolon=1;
} else{
unput_semicolon=0;
}
if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) {
if (unput_semicolon) {
unput(';');
}
efree(CG(heredoc));
CG(heredoc)=NULL;
CG(heredoc_len)=0;