shithub: libmujs

Download patch

ref: 299d6c71c689ceb737b57c229f53334af1627fb1
parent: 03b291f6e87c28a49b135fcdd0bf8e32c1d797aa
author: Tor Andersson <tor@ccxvii.net>
date: Wed Feb 5 00:17:50 EST 2014

Fix typo in CR/LF handling in lexer.

--- a/jslex.c
+++ b/jslex.c
@@ -160,7 +160,7 @@
 	Rune c;
 	J->source += chartorune(&c, J->source);
 	/* consume CR LF as one unit */
-	if (c == '\r' && PEEK == '\n')
+	if (c == '\r' && *J->source == '\n')
 		++J->source;
 	if (isnewline(c)) {
 		J->line++;
@@ -464,7 +464,7 @@
 	}
 }
 
-static int lex(js_State *J)
+static int jsY_lexx(js_State *J)
 {
 	J->newline = 0;
 
@@ -657,5 +657,5 @@
 
 int jsY_lex(js_State *J)
 {
-	return J->lasttoken = lex(J);
+	return J->lasttoken = jsY_lexx(J);
 }