Skip to content

Commit 46ab9db

Browse files
author
hornik
committed
Fix PR#18855 issue 6. By Duncan Murdoch.
git-svn-id: https://svn.r-project.org/R/trunk@87795 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 7d76c4d commit 46ab9db

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/library/tools/src/gramLatex.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,6 +2145,10 @@ static SEXP xxenv(SEXP begin, SEXP body, SEXP end, YYLTYPE *lloc)
21452145
yyerror(buffer);
21462146
return NULL;
21472147
}
2148+
2149+
if (strcmp("document", CHAR(STRING_ELT(end, 0))) == 0) {
2150+
xxungetc(R_EOF); /* Stop reading after \end{document} */
2151+
}
21482152

21492153
PRESERVE_SV(ans = allocVector(VECSXP, 2));
21502154
SET_VECTOR_ELT(ans, 0, begin);

src/library/tools/src/gramLatex.y

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ static SEXP xxenv(SEXP begin, SEXP body, SEXP end, YYLTYPE *lloc)
271271
yyerror(buffer);
272272
return NULL;
273273
}
274+
275+
if (strcmp("document", CHAR(STRING_ELT(end, 0))) == 0) {
276+
xxungetc(R_EOF); /* Stop reading after \end{document} */
277+
}
274278

275279
PRESERVE_SV(ans = allocVector(VECSXP, 2));
276280
SET_VECTOR_ELT(ans, 0, begin);

0 commit comments

Comments
 (0)