Don't peek over newlines, since we assume that ts->ungetpos refers to a point on our line. bug 344711, r=brendan

git-svn-id: svn://10.0.0.236/trunk@202277 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mrbkap%gmail.com 2006-07-18 00:35:15 +00:00
parent 80f7ab37a7
commit e76a894911

View File

@ -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--)