ext/include/iv/lexer.h in iv-phonic-0.1.7 vs ext/include/iv/lexer.h in iv-phonic-0.1.8
- old
+ new
@@ -465,20 +465,19 @@
return true;
}
bool ScanRegExpFlags() {
buffer16_.clear();
- uc16 uc;
while (Chars::IsIdentifierPart(c_)) {
if (c_ == '\\') {
Advance();
if (c_ != 'u') {
return false;
}
Advance();
bool ng = false;
- uc = ScanHexEscape('u', 4, &ng);
+ const uc16 uc = ScanHexEscape('u', 4, &ng);
if (ng || uc == '\\') {
return false;
}
Record16(uc);
} else {
@@ -612,22 +611,20 @@
return Token::NOT_FOUND;
}
template<typename LexType>
Token::Type ScanIdentifier(bool strict) {
- uc16 uc;
-
buffer16_.clear();
if (c_ == '\\') {
Advance();
if (c_ != 'u') {
return Token::ILLEGAL;
}
Advance();
bool ng = false;
- uc = ScanHexEscape('u', 4, &ng);
+ const uc16 uc = ScanHexEscape('u', 4, &ng);
if (ng || uc == '\\' || !Chars::IsIdentifierStart(uc)) {
return Token::ILLEGAL;
}
Record16(uc);
} else {
@@ -640,11 +637,11 @@
if (c_ != 'u') {
return Token::ILLEGAL;
}
Advance();
bool ng = false;
- uc = ScanHexEscape('u', 4, &ng);
+ const uc16 uc = ScanHexEscape('u', 4, &ng);
if (ng || uc == '\\' || !Chars::IsIdentifierPart(uc)) {
return Token::ILLEGAL;
}
Record16(uc);
} else {
@@ -693,54 +690,70 @@
case '\'':
case '"' :
case '\\':
Record16Advance();
break;
+
case 'b' :
Record16('\b');
Advance();
break;
+
case 'f' :
Record16('\f');
Advance();
break;
+
case 'n' :
Record16('\n');
Advance();
break;
+
case 'r' :
Record16('\r');
Advance();
break;
+
case 't' :
Record16('\t');
Advance();
break;
+
case 'u' : {
Advance();
bool ng = false;
const uc16 uc = ScanHexEscape('u', 4, &ng);
if (ng) {
return false;
}
Record16(uc);
break;
}
+
case 'v' :
Record16('\v');
Advance();
break;
+
case 'x' : {
Advance();
bool ng = false;
const uc16 uc = ScanHexEscape('x', 2, &ng);
if (ng) {
return false;
}
Record16(uc);
break;
}
- case '0' :
+
+ case '0' : {
+ if (type_ != OCTAL) {
+ type_ = OCTAL;
+ }
+ Record16(ScanOctalEscape());
+ break;
+ }
+
case '1' :
case '2' :
case '3' :
case '4' :
case '5' :