diff --git a/mozilla/js/src/jsscan.c b/mozilla/js/src/jsscan.c index 4f55233f519..e4994eb4a49 100644 --- a/mozilla/js/src/jsscan.c +++ b/mozilla/js/src/jsscan.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: set sw=4 ts=8 et tw=80: + * vim: set sw=4 ts=8 et tw=78: * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -477,6 +477,11 @@ PeekChar(JSTokenStream *ts) return c; } +/* + * Peek n chars ahead into ts. Return true if n chars were read, false if + * there weren't enough characters in the input stream. This function cannot + * be used to peek into or past a newline. + */ static JSBool PeekChars(JSTokenStream *ts, intN n, jschar *cp) { @@ -487,6 +492,10 @@ PeekChars(JSTokenStream *ts, intN n, jschar *cp) c = GetChar(ts); if (c == EOF) break; + if (c == '\n') { + UngetChar(ts, c); + break; + } cp[i] = (jschar)c; } for (j = i - 1; j >= 0; j--)