|
@@ -140,6 +140,25 @@ static void tAddString() {
|
|
tAdd(&c, 1);
|
|
tAdd(&c, 1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void tAddUnicode() {
|
|
|
|
+ int c = fRead();
|
|
|
|
+ if((c & 0xE0) == 0xC0) {
|
|
|
|
+ c = ((c & 0x1F) << 6) | (fRead() & 0x3F);
|
|
|
|
+ } else if((c & 0xF0) == 0xE0) {
|
|
|
|
+ c = ((c & 0xF) << 12) | ((fRead() & 0x3F) << 6);
|
|
|
|
+ c |= fRead() & 0x3F;
|
|
|
|
+ } else if((c & 0xF8) == 0xF0) {
|
|
|
|
+ c = ((c & 0x7) << 18) | ((fRead() & 0x3F) << 12);
|
|
|
|
+ c |= (fRead() & 0x3F) << 6;
|
|
|
|
+ c |= fRead() & 0x3F;
|
|
|
|
+ }
|
|
|
|
+ tAddToken(T_CONST_INT);
|
|
|
|
+ tAdd(&c, sizeof(int));
|
|
|
|
+ if(fRead() != '\'') {
|
|
|
|
+ tError("expecting unicode end");
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
static void tAddToken2(Token te, Token t) {
|
|
static void tAddToken2(Token te, Token t) {
|
|
if(fReadIf('=')) {
|
|
if(fReadIf('=')) {
|
|
tAddToken(te);
|
|
tAddToken(te);
|
|
@@ -238,6 +257,7 @@ static void tParseToken(int c) {
|
|
case '{': tAddToken(T_OPEN_CURVED_BRACKET); return;
|
|
case '{': tAddToken(T_OPEN_CURVED_BRACKET); return;
|
|
case '}': tAddToken(T_CLOSE_CURVED_BRACKET); return;
|
|
case '}': tAddToken(T_CLOSE_CURVED_BRACKET); return;
|
|
case '"': tAddString(); return;
|
|
case '"': tAddString(); return;
|
|
|
|
+ case '\'': tAddUnicode(); return;
|
|
case '.': tAddToken(T_POINT); return;
|
|
case '.': tAddToken(T_POINT); return;
|
|
case '[': tAddToken(T_OPEN_SQUARE_BRACKET); return;
|
|
case '[': tAddToken(T_OPEN_SQUARE_BRACKET); return;
|
|
case ']': tAddToken(T_CLOSE_SQUARE_BRACKET); return;
|
|
case ']': tAddToken(T_CLOSE_SQUARE_BRACKET); return;
|
|
@@ -272,6 +292,10 @@ const char* tGetError() {
|
|
return error;
|
|
return error;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int tGetLine() {
|
|
|
|
+ return line;
|
|
|
|
+}
|
|
|
|
+
|
|
void tResetReader() {
|
|
void tResetReader() {
|
|
readIndex = 0;
|
|
readIndex = 0;
|
|
}
|
|
}
|