Commit 61d5c158 by Tom Tromey Committed by Tom Tromey

lex.c (java_lineterminator): Don't recognize \r after \n.

	* lex.c (java_lineterminator): Don't recognize \r after \n.  If \r
	follows \r, then unget it at a lower level.

From-SVN: r34782
parent 3097c22b
2000-06-27 Tom Tromey <tromey@cygnus.com>
* lex.c (java_lineterminator): Don't recognize \r after \n. If \r
follows \r, then unget it at a lower level.
2000-06-26 Tom Tromey <tromey@cygnus.com> 2000-06-26 Tom Tromey <tromey@cygnus.com>
* parse.y (resolve_field_access): Pass decl, not DECL_INITIAL, to * parse.y (resolve_field_access): Pass decl, not DECL_INITIAL, to
......
...@@ -347,19 +347,23 @@ static int ...@@ -347,19 +347,23 @@ static int
java_lineterminator (c) java_lineterminator (c)
unicode_t c; unicode_t c;
{ {
int unicode_escape_p; if (c == '\n') /* LF */
if (c == '\n') /* CR */ return 1;
else if (c == '\r') /* CR */
{ {
if ((c = java_read_unicode (1, &unicode_escape_p)) != '\r') int unicode_escape_p;
c = java_read_unicode (1, &unicode_escape_p);
if (c == '\r')
{ {
ctxp->c_line->ahead [0] = c; /* In this case we will have another terminator. For some
ctxp->c_line->unicode_escape_ahead_p = unicode_escape_p; reason the lexer has several different unget methods. We
can't use the `ahead' method because then the \r will end
up in the actual text of the line, causing an error. So
instead we choose a very low-level method. FIXME: this
is incredibly ugly. */
UNGETC (c);
} }
return 1; else if (c != '\n')
}
else if (c == '\r') /* LF */
{
if ((c = java_read_unicode (1, &unicode_escape_p)) != '\n')
{ {
ctxp->c_line->ahead [0] = c; ctxp->c_line->ahead [0] = c;
ctxp->c_line->unicode_escape_ahead_p = unicode_escape_p; ctxp->c_line->unicode_escape_ahead_p = unicode_escape_p;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment