From 0b04c561f5c08600831f3bb6126b062658d434b1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 14 Feb 2014 13:23:51 -0200 Subject: new syntax for Unicode escape '\u{012F}' --- llex.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'llex.c') diff --git a/llex.c b/llex.c index 514a8150..a9a2db04 100644 --- a/llex.c +++ b/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.72 2014/02/04 18:57:34 roberto Exp roberto $ +** $Id: llex.c,v 2.73 2014/02/06 15:59:24 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -345,15 +345,18 @@ static int readhexaesc (LexState *ls) { static unsigned int readutf8esc (LexState *ls) { - int i = 3; /* chars to be removed: '\', 'u', and first digit */ - unsigned int r = gethexa(ls); /* must have at least one digit */ + unsigned int r; + int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ + save_and_next(ls); /* skip 'u' */ + esccheck(ls, ls->current == '{', "missing '{'"); + r = gethexa(ls); /* must have at least one digit */ while ((save_and_next(ls), lisxdigit(ls->current))) { i++; r = (r << 4) + luaO_hexavalue(ls->current); esccheck(ls, r <= 0x10FFFF, "UTF-8 value too large"); } - esccheck(ls, ls->current == ';', "missing ';' in UTF-8 escape"); - next(ls); /* skip ';' */ + esccheck(ls, ls->current == '}', "missing '}'"); + next(ls); /* skip '}' */ luaZ_buffremove(ls->buff, i); /* remove saved chars from buffer */ return r; } -- cgit v1.2.3-55-g6feb