@agoric/xsnap 0.14.3-u14.0 → 0.14.3-u16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/api.js +4 -2
- package/build.env +1 -1
- package/moddable/modules/data/base64/base64.js +28 -0
- package/moddable/modules/data/base64/manifest.json +11 -0
- package/moddable/modules/data/base64/modBase64.c +188 -0
- package/moddable/modules/data/binaryMessage/BinaryMessage.js +106 -0
- package/moddable/modules/data/crc/crc.c +205 -0
- package/moddable/modules/data/crc/crc.js +36 -0
- package/moddable/modules/data/crc/manifest.json +8 -0
- package/moddable/modules/data/hex/hex.js +28 -0
- package/moddable/modules/data/hex/manifest.json +11 -0
- package/moddable/modules/data/hex/modHex.c +139 -0
- package/moddable/modules/data/logical/logical.js +32 -0
- package/moddable/modules/data/logical/modLogical.c +98 -0
- package/moddable/modules/data/qrcode/manifest.json +9 -0
- package/moddable/modules/data/qrcode/qrcode.c +93 -0
- package/moddable/modules/data/qrcode/qrcode.js +23 -0
- package/moddable/modules/data/qrcode/qrcodegen.c +1025 -0
- package/moddable/modules/data/qrcode/qrcodegen.h +267 -0
- package/moddable/modules/data/text/decoder/manifest.json +8 -0
- package/moddable/modules/data/text/decoder/textdecoder.c +480 -0
- package/moddable/modules/data/text/decoder/textdecoder.js +27 -0
- package/moddable/modules/data/text/encoder/manifest.json +8 -0
- package/moddable/modules/data/text/encoder/textencoder.c +232 -0
- package/moddable/modules/data/text/encoder/textencoder.js +24 -0
- package/moddable/modules/data/tinyint/tinyint.c +150 -0
- package/moddable/modules/data/tinyint/tinyint.js +53 -0
- package/moddable/modules/data/url/manifest.json +17 -0
- package/moddable/modules/data/url/url.c +1959 -0
- package/moddable/modules/data/url/url.js +210 -0
- package/moddable/modules/data/wavreader/manifest.json +8 -0
- package/moddable/modules/data/wavreader/wavreader.js +128 -0
- package/moddable/modules/data/zlib/deflate.c +161 -0
- package/moddable/modules/data/zlib/deflate.js +63 -0
- package/moddable/modules/data/zlib/inflate.c +145 -0
- package/moddable/modules/data/zlib/inflate.js +66 -0
- package/moddable/modules/data/zlib/manifest_deflate.json +9 -0
- package/moddable/modules/data/zlib/manifest_inflate.json +9 -0
- package/moddable/modules/data/zlib/miniz.c +4924 -0
- package/moddable/xs/includes/xs.d.ts +73 -0
- package/moddable/xs/includes/xs.h +1533 -0
- package/moddable/xs/includes/xsmc.h +206 -0
- package/moddable/xs/makefiles/lin/makefile +33 -0
- package/moddable/xs/makefiles/lin/xsc.mk +118 -0
- package/moddable/xs/makefiles/lin/xsid.mk +90 -0
- package/moddable/xs/makefiles/lin/xsl.mk +168 -0
- package/moddable/xs/makefiles/lin/xst.mk +201 -0
- package/moddable/xs/makefiles/mac/makefile +33 -0
- package/moddable/xs/makefiles/mac/xsc.mk +130 -0
- package/moddable/xs/makefiles/mac/xsid.mk +102 -0
- package/moddable/xs/makefiles/mac/xsl.mk +177 -0
- package/moddable/xs/makefiles/mac/xst.mk +203 -0
- package/moddable/xs/makefiles/mac/xst_no_asan.txt +52 -0
- package/moddable/xs/makefiles/win/build.bat +26 -0
- package/moddable/xs/makefiles/win/xsc.mak +142 -0
- package/moddable/xs/makefiles/win/xsid.mak +113 -0
- package/moddable/xs/makefiles/win/xsl.mak +186 -0
- package/moddable/xs/makefiles/win/xst.mak +195 -0
- package/moddable/xs/platforms/lin_xs.h +99 -0
- package/moddable/xs/platforms/mac_xs.h +97 -0
- package/moddable/xs/platforms/wasm_xs.h +79 -0
- package/moddable/xs/platforms/win_xs.h +104 -0
- package/moddable/xs/platforms/xsHost.h +63 -0
- package/moddable/xs/platforms/xsPlatform.h +618 -0
- package/moddable/xs/sources/xsAPI.c +2555 -0
- package/moddable/xs/sources/xsAll.c +294 -0
- package/moddable/xs/sources/xsAll.h +2741 -0
- package/moddable/xs/sources/xsArguments.c +222 -0
- package/moddable/xs/sources/xsArray.c +2657 -0
- package/moddable/xs/sources/xsAtomics.c +844 -0
- package/moddable/xs/sources/xsBigInt.c +1859 -0
- package/moddable/xs/sources/xsBoolean.c +109 -0
- package/moddable/xs/sources/xsCode.c +4493 -0
- package/moddable/xs/sources/xsCommon.c +1710 -0
- package/moddable/xs/sources/xsCommon.h +1142 -0
- package/moddable/xs/sources/xsDataView.c +2890 -0
- package/moddable/xs/sources/xsDate.c +1541 -0
- package/moddable/xs/sources/xsDebug.c +2710 -0
- package/moddable/xs/sources/xsDefaults.c +134 -0
- package/moddable/xs/sources/xsError.c +353 -0
- package/moddable/xs/sources/xsFunction.c +776 -0
- package/moddable/xs/sources/xsGenerator.c +865 -0
- package/moddable/xs/sources/xsGlobal.c +839 -0
- package/moddable/xs/sources/xsJSON.c +1091 -0
- package/moddable/xs/sources/xsLexical.c +1969 -0
- package/moddable/xs/sources/xsLockdown.c +933 -0
- package/moddable/xs/sources/xsMapSet.c +1649 -0
- package/moddable/xs/sources/xsMarshall.c +1020 -0
- package/moddable/xs/sources/xsMath.c +624 -0
- package/moddable/xs/sources/xsMemory.c +1941 -0
- package/moddable/xs/sources/xsModule.c +3101 -0
- package/moddable/xs/sources/xsNumber.c +560 -0
- package/moddable/xs/sources/xsObject.c +1102 -0
- package/moddable/xs/sources/xsPlatforms.c +480 -0
- package/moddable/xs/sources/xsProfile.c +577 -0
- package/moddable/xs/sources/xsPromise.c +1199 -0
- package/moddable/xs/sources/xsProperty.c +636 -0
- package/moddable/xs/sources/xsProxy.c +1014 -0
- package/moddable/xs/sources/xsRegExp.c +1168 -0
- package/moddable/xs/sources/xsRun.c +4889 -0
- package/moddable/xs/sources/xsScope.c +1293 -0
- package/moddable/xs/sources/xsScript.c +288 -0
- package/moddable/xs/sources/xsScript.h +1186 -0
- package/moddable/xs/sources/xsSnapshot.c +2161 -0
- package/moddable/xs/sources/xsSnapshot.h +51 -0
- package/moddable/xs/sources/xsSourceMap.c +218 -0
- package/moddable/xs/sources/xsString.c +3332 -0
- package/moddable/xs/sources/xsSymbol.c +503 -0
- package/moddable/xs/sources/xsSyntaxical.c +4193 -0
- package/moddable/xs/sources/xsTree.c +1893 -0
- package/moddable/xs/sources/xsType.c +1488 -0
- package/moddable/xs/sources/xsdtoa.c +6672 -0
- package/moddable/xs/sources/xsmc.c +340 -0
- package/moddable/xs/sources/xsre.c +7578 -0
- package/package.json +37 -20
- package/scripts/get_xsnap_version.sh +14 -0
- package/scripts/test-package.sh +21 -0
- package/src/avaAssertXS.js +6 -2
- package/src/avaHandler.cjs +2 -5
- package/src/avaXS.js +7 -8
- package/src/build.js +161 -28
- package/src/replay.js +0 -3
- package/src/xsnap.js +105 -91
- package/src/xsrepl.js +2 -3
- package/xsnap-native/xsnap/makefiles/lin/makefile +10 -0
- package/xsnap-native/xsnap/makefiles/lin/xsnap-worker.mk +156 -0
- package/xsnap-native/xsnap/makefiles/lin/xsnap.mk +144 -0
- package/xsnap-native/xsnap/makefiles/mac/makefile +10 -0
- package/xsnap-native/xsnap/makefiles/mac/xsnap-worker.mk +165 -0
- package/xsnap-native/xsnap/makefiles/mac/xsnap.mk +153 -0
- package/xsnap-native/xsnap/sources/xsnap-worker.c +1008 -0
- package/xsnap-native/xsnap/sources/xsnap.c +717 -0
- package/xsnap-native/xsnap/sources/xsnap.h +142 -0
- package/xsnap-native/xsnap/sources/xsnapPlatform.c +1501 -0
- package/xsnap-native/xsnap/sources/xsnapPlatform.h +105 -0
- package/CHANGELOG.md +0 -654
|
@@ -0,0 +1,1969 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-2017 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
* This file incorporates work covered by the following copyright and
|
|
20
|
+
* permission notice:
|
|
21
|
+
*
|
|
22
|
+
* Copyright (C) 2010-2016 Marvell International Ltd.
|
|
23
|
+
* Copyright (C) 2002-2010 Kinoma, Inc.
|
|
24
|
+
*
|
|
25
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26
|
+
* you may not use this file except in compliance with the License.
|
|
27
|
+
* You may obtain a copy of the License at
|
|
28
|
+
*
|
|
29
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
30
|
+
*
|
|
31
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
32
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
33
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
34
|
+
* See the License for the specific language governing permissions and
|
|
35
|
+
* limitations under the License.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
#include "xsScript.h"
|
|
39
|
+
|
|
40
|
+
static txU4 fxGetNextCode(txParser* parser);
|
|
41
|
+
static txString fxGetNextDigits(txParser* parser, txString (*f)(txParser*, txString, txString), txString p, txString q, int empty);
|
|
42
|
+
static txString fxGetNextDigitsB(txParser* parser, txString p, txString q);
|
|
43
|
+
static txString fxGetNextDigitsD(txParser* parser, txString p, txString q, int* base);
|
|
44
|
+
static txString fxGetNextDigitsE(txParser* parser, txString p, txString q);
|
|
45
|
+
static txString fxGetNextDigitsO(txParser* parser, txString p, txString q);
|
|
46
|
+
static txString fxGetNextDigitsX(txParser* parser, txString p, txString q);
|
|
47
|
+
static void fxGetNextKeyword(txParser* parser);
|
|
48
|
+
static txBoolean fxGetNextIdentiferX(txParser* parser, txU4* value);
|
|
49
|
+
static void fxGetNextNumber(txParser* parser, txNumber theNumber);
|
|
50
|
+
static void fxGetNextNumberB(txParser* parser);
|
|
51
|
+
static void fxGetNextNumberE(txParser* parser, int parseDot);
|
|
52
|
+
static void fxGetNextNumberO(txParser* parser, int c, int i);
|
|
53
|
+
static void fxGetNextNumberX(txParser* parser);
|
|
54
|
+
static void fxGetNextString(txParser* parser, int c);
|
|
55
|
+
static txBoolean fxGetNextStringD(int c, txU4* value);
|
|
56
|
+
static txBoolean fxGetNextStringX(int c, txU4* value);
|
|
57
|
+
static void fxGetNextTokenAux(txParser* parser);
|
|
58
|
+
|
|
59
|
+
#define XS_KEYWORD_COUNT 36
|
|
60
|
+
static const txKeyword ICACHE_RODATA_ATTR gxKeywords[XS_KEYWORD_COUNT] = {
|
|
61
|
+
{ "break", XS_TOKEN_BREAK },
|
|
62
|
+
{ "case", XS_TOKEN_CASE },
|
|
63
|
+
{ "catch", XS_TOKEN_CATCH },
|
|
64
|
+
{ "class", XS_TOKEN_CLASS },
|
|
65
|
+
{ "const", XS_TOKEN_CONST },
|
|
66
|
+
{ "continue", XS_TOKEN_CONTINUE },
|
|
67
|
+
{ "debugger", XS_TOKEN_DEBUGGER },
|
|
68
|
+
{ "default", XS_TOKEN_DEFAULT },
|
|
69
|
+
{ "delete", XS_TOKEN_DELETE },
|
|
70
|
+
{ "do", XS_TOKEN_DO },
|
|
71
|
+
{ "else", XS_TOKEN_ELSE },
|
|
72
|
+
{ "enum", XS_TOKEN_ENUM },
|
|
73
|
+
{ "export", XS_TOKEN_EXPORT },
|
|
74
|
+
{ "extends", XS_TOKEN_EXTENDS },
|
|
75
|
+
{ "false", XS_TOKEN_FALSE },
|
|
76
|
+
{ "finally", XS_TOKEN_FINALLY },
|
|
77
|
+
{ "for", XS_TOKEN_FOR },
|
|
78
|
+
{ "function", XS_TOKEN_FUNCTION },
|
|
79
|
+
{ "if", XS_TOKEN_IF },
|
|
80
|
+
{ "import", XS_TOKEN_IMPORT },
|
|
81
|
+
{ "in", XS_TOKEN_IN },
|
|
82
|
+
{ "instanceof", XS_TOKEN_INSTANCEOF },
|
|
83
|
+
{ "new", XS_TOKEN_NEW },
|
|
84
|
+
{ "null", XS_TOKEN_NULL },
|
|
85
|
+
{ "return", XS_TOKEN_RETURN },
|
|
86
|
+
{ "super", XS_TOKEN_SUPER },
|
|
87
|
+
{ "switch", XS_TOKEN_SWITCH },
|
|
88
|
+
{ "this", XS_TOKEN_THIS },
|
|
89
|
+
{ "throw", XS_TOKEN_THROW },
|
|
90
|
+
{ "true", XS_TOKEN_TRUE },
|
|
91
|
+
{ "try", XS_TOKEN_TRY },
|
|
92
|
+
{ "typeof", XS_TOKEN_TYPEOF },
|
|
93
|
+
{ "var", XS_TOKEN_VAR },
|
|
94
|
+
{ "void", XS_TOKEN_VOID },
|
|
95
|
+
{ "while", XS_TOKEN_WHILE },
|
|
96
|
+
{ "with", XS_TOKEN_WITH }
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
#define XS_STRICT_KEYWORD_COUNT 9
|
|
100
|
+
static const txKeyword ICACHE_RODATA_ATTR gxStrictKeywords[XS_STRICT_KEYWORD_COUNT] = {
|
|
101
|
+
{ "implements", XS_TOKEN_IMPLEMENTS },
|
|
102
|
+
{ "interface", XS_TOKEN_INTERFACE },
|
|
103
|
+
{ "let", XS_TOKEN_LET },
|
|
104
|
+
{ "package", XS_TOKEN_PACKAGE },
|
|
105
|
+
{ "private", XS_TOKEN_PRIVATE },
|
|
106
|
+
{ "protected", XS_TOKEN_PROTECTED },
|
|
107
|
+
{ "public", XS_TOKEN_PUBLIC },
|
|
108
|
+
{ "static", XS_TOKEN_STATIC },
|
|
109
|
+
{ "yield", XS_TOKEN_YIELD }
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
static txString fxUTF8Buffer(txParser* parser, txInteger character, txString string, txString limit)
|
|
113
|
+
{
|
|
114
|
+
if (string + mxStringByteLength(character) > limit) {
|
|
115
|
+
fxReportMemoryError(parser, parser->line, "buffer overflow");
|
|
116
|
+
}
|
|
117
|
+
return mxStringByteEncode(string, character);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
void fxCheckStrictKeyword(txParser* parser)
|
|
121
|
+
{
|
|
122
|
+
int low, high, anIndex, aDelta;
|
|
123
|
+
for (low = 0, high = XS_STRICT_KEYWORD_COUNT; high > low;
|
|
124
|
+
(aDelta < 0) ? (low = anIndex + 1) : (high = anIndex)) {
|
|
125
|
+
anIndex = low + ((high - low) / 2);
|
|
126
|
+
aDelta = c_strcmp(gxStrictKeywords[anIndex].text, parser->buffer);
|
|
127
|
+
if (aDelta == 0) {
|
|
128
|
+
parser->token = gxStrictKeywords[anIndex].token;
|
|
129
|
+
goto bail;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
bail:
|
|
133
|
+
if (parser->escaped2)
|
|
134
|
+
fxReportParserError(parser, parser->line, "escaped keyword");
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
void fxGetNextCharacter(txParser* parser)
|
|
138
|
+
{
|
|
139
|
+
parser->character = parser->lookahead;
|
|
140
|
+
if (parser->character != (txU4)C_EOF) {
|
|
141
|
+
#if mxCESU8
|
|
142
|
+
txU4 character = parser->surrogate;
|
|
143
|
+
if (character)
|
|
144
|
+
parser->surrogate = 0;
|
|
145
|
+
else
|
|
146
|
+
character = fxGetNextCode(parser);
|
|
147
|
+
if ((0x0000D800 <= character) && (character <= 0x0000DBFF)) {
|
|
148
|
+
txU4 surrogate = fxGetNextCode(parser);
|
|
149
|
+
if ((0x0000DC00 <= surrogate) && (surrogate <= 0x0000DFFF))
|
|
150
|
+
character = 0x00010000 + ((character & 0x000003FF) << 10) + (surrogate & 0x000003FF);
|
|
151
|
+
else
|
|
152
|
+
parser->surrogate = surrogate;
|
|
153
|
+
}
|
|
154
|
+
parser->lookahead = character;
|
|
155
|
+
#else
|
|
156
|
+
parser->lookahead = fxGetNextCode(parser);
|
|
157
|
+
#endif
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
txU4 fxGetNextCode(txParser* parser)
|
|
162
|
+
{
|
|
163
|
+
txU4 code = (txU4)(*(parser->getter))(parser->stream);
|
|
164
|
+
if ((code & 0x80) && (code != (txU4)C_EOF)) {
|
|
165
|
+
txUTF8Sequence const *sequence = NULL;
|
|
166
|
+
for (sequence = gxUTF8Sequences; sequence->size; sequence++) {
|
|
167
|
+
if ((code & sequence->cmask) == sequence->cval)
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
if (sequence->size == 0) {
|
|
171
|
+
fxReportParserError(parser, parser->line, "invalid character %d", code);
|
|
172
|
+
code = (txU4)C_EOF;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
txS4 size = sequence->size - 1;
|
|
176
|
+
while (size) {
|
|
177
|
+
size--;
|
|
178
|
+
code = (code << 6) | ((*(parser->getter))(parser->stream) & 0x3F);
|
|
179
|
+
}
|
|
180
|
+
code &= sequence->lmask;
|
|
181
|
+
}
|
|
182
|
+
if (code == 0x000110000)
|
|
183
|
+
code = 0;
|
|
184
|
+
}
|
|
185
|
+
return code;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
txString fxGetNextDigits(txParser* parser, txString (*f)(txParser*, txString, txString), txString p, txString q, int empty)
|
|
189
|
+
{
|
|
190
|
+
int separator = 0;
|
|
191
|
+
for (;;) {
|
|
192
|
+
txString r = p;
|
|
193
|
+
p = (*f)(parser, p, q);
|
|
194
|
+
if (r < p) {
|
|
195
|
+
empty = 0;
|
|
196
|
+
separator = 0;
|
|
197
|
+
if (parser->character == '_') {
|
|
198
|
+
fxGetNextCharacter(parser);
|
|
199
|
+
separator = 1;
|
|
200
|
+
}
|
|
201
|
+
else
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
else
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
if (empty || separator)
|
|
208
|
+
fxReportParserError(parser, parser->line, "invalid number");
|
|
209
|
+
return p;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
txString fxGetNextDigitsB(txParser* parser, txString p, txString q)
|
|
213
|
+
{
|
|
214
|
+
int c = parser->character;
|
|
215
|
+
while (('0' <= c) && (c <= '1')) {
|
|
216
|
+
if (p < q) *p++ = (char)c;
|
|
217
|
+
fxGetNextCharacter(parser);
|
|
218
|
+
c = parser->character;
|
|
219
|
+
}
|
|
220
|
+
return p;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
txString fxGetNextDigitsD(txParser* parser, txString p, txString q, int* base)
|
|
224
|
+
{
|
|
225
|
+
int c = parser->character;
|
|
226
|
+
*base = 8;
|
|
227
|
+
while (('0' <= c) && (c <= '9')) {
|
|
228
|
+
if (p < q) *p++ = (char)c;
|
|
229
|
+
if (('8' <= c) && (c <= '9'))
|
|
230
|
+
*base = 10;
|
|
231
|
+
fxGetNextCharacter(parser);
|
|
232
|
+
c = parser->character;
|
|
233
|
+
}
|
|
234
|
+
return p;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
txString fxGetNextDigitsE(txParser* parser, txString p, txString q)
|
|
238
|
+
{
|
|
239
|
+
int c = parser->character;
|
|
240
|
+
while (('0' <= c) && (c <= '9')) {
|
|
241
|
+
if (p < q) *p++ = (char)c;
|
|
242
|
+
fxGetNextCharacter(parser);
|
|
243
|
+
c = parser->character;
|
|
244
|
+
}
|
|
245
|
+
return p;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
txString fxGetNextDigitsO(txParser* parser, txString p, txString q)
|
|
249
|
+
{
|
|
250
|
+
int c = parser->character;
|
|
251
|
+
while (('0' <= c) && (c <= '7')) {
|
|
252
|
+
if (p < q) *p++ = (char)c;
|
|
253
|
+
fxGetNextCharacter(parser);
|
|
254
|
+
c = parser->character;
|
|
255
|
+
}
|
|
256
|
+
return p;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
txString fxGetNextDigitsX(txParser* parser, txString p, txString q)
|
|
260
|
+
{
|
|
261
|
+
int c = parser->character;
|
|
262
|
+
while ((('0' <= c) && (c <= '9')) || (('a' <= c) && (c <= 'f')) || (('A' <= c) && (c <= 'F'))) {
|
|
263
|
+
if (p < q) *p++ = (char)c;
|
|
264
|
+
fxGetNextCharacter(parser);
|
|
265
|
+
c = parser->character;
|
|
266
|
+
}
|
|
267
|
+
return p;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
void fxGetNextKeyword(txParser* parser)
|
|
271
|
+
{
|
|
272
|
+
int low, high, anIndex, aDelta;
|
|
273
|
+
|
|
274
|
+
parser->symbol2 = fxNewParserSymbol(parser, parser->buffer);
|
|
275
|
+
parser->token2 = XS_TOKEN_IDENTIFIER;
|
|
276
|
+
if ((parser->token == XS_TOKEN_DOT) || (parser->token == XS_TOKEN_CHAIN))
|
|
277
|
+
return;
|
|
278
|
+
for (low = 0, high = XS_KEYWORD_COUNT; high > low;
|
|
279
|
+
(aDelta < 0) ? (low = anIndex + 1) : (high = anIndex)) {
|
|
280
|
+
anIndex = low + ((high - low) / 2);
|
|
281
|
+
aDelta = c_strcmp(gxKeywords[anIndex].text, parser->buffer);
|
|
282
|
+
if (aDelta == 0) {
|
|
283
|
+
parser->token2 = gxKeywords[anIndex].token;
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if ((parser->flags & mxStrictFlag)) {
|
|
288
|
+
for (low = 0, high = XS_STRICT_KEYWORD_COUNT; high > low;
|
|
289
|
+
(aDelta < 0) ? (low = anIndex + 1) : (high = anIndex)) {
|
|
290
|
+
anIndex = low + ((high - low) / 2);
|
|
291
|
+
aDelta = c_strcmp(gxStrictKeywords[anIndex].text, parser->buffer);
|
|
292
|
+
if (aDelta == 0) {
|
|
293
|
+
parser->token2 = gxStrictKeywords[anIndex].token;
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (c_strcmp("await", parser->buffer) == 0) {
|
|
299
|
+
if (parser->flags & mxAsyncFlag) {
|
|
300
|
+
parser->token2 = XS_TOKEN_AWAIT;
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (c_strcmp("yield", parser->buffer) == 0) {
|
|
305
|
+
if ((parser->flags & mxGeneratorFlag)){
|
|
306
|
+
parser->token2 = XS_TOKEN_YIELD;
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
txBoolean fxGetNextIdentiferX(txParser* parser, txU4* value)
|
|
314
|
+
{
|
|
315
|
+
fxGetNextCharacter(parser);
|
|
316
|
+
if (parser->character == 'u') {
|
|
317
|
+
fxGetNextCharacter(parser);
|
|
318
|
+
if (parser->character == '{') {
|
|
319
|
+
fxGetNextCharacter(parser);
|
|
320
|
+
while (fxGetNextStringX(parser->character, value)) {
|
|
321
|
+
fxGetNextCharacter(parser);
|
|
322
|
+
}
|
|
323
|
+
if (parser->character == '}') {
|
|
324
|
+
fxGetNextCharacter(parser);
|
|
325
|
+
return 1;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
if (fxGetNextStringX(parser->character, value)) {
|
|
330
|
+
fxGetNextCharacter(parser);
|
|
331
|
+
if (fxGetNextStringX(parser->character, value)) {
|
|
332
|
+
fxGetNextCharacter(parser);
|
|
333
|
+
if (fxGetNextStringX(parser->character, value)) {
|
|
334
|
+
fxGetNextCharacter(parser);
|
|
335
|
+
if (fxGetNextStringX(parser->character, value)) {
|
|
336
|
+
fxGetNextCharacter(parser);
|
|
337
|
+
return 1;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return 0;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
void fxGetNextNumber(txParser* parser, txNumber theNumber)
|
|
348
|
+
{
|
|
349
|
+
parser->number2 = theNumber;
|
|
350
|
+
parser->integer2 = (txInteger)parser->number2;
|
|
351
|
+
theNumber = parser->integer2;
|
|
352
|
+
if (parser->number2 == theNumber)
|
|
353
|
+
parser->token2 = XS_TOKEN_INTEGER;
|
|
354
|
+
else
|
|
355
|
+
parser->token2 = XS_TOKEN_NUMBER;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
void fxGetNextNumberB(txParser* parser)
|
|
359
|
+
{
|
|
360
|
+
txString p = parser->buffer;
|
|
361
|
+
txString q = p + parser->bufferSize;
|
|
362
|
+
int c;
|
|
363
|
+
fxGetNextCharacter(parser);
|
|
364
|
+
p = fxGetNextDigits(parser, fxGetNextDigitsB, p, q, 1);
|
|
365
|
+
c = parser->character;
|
|
366
|
+
if (p == q) {
|
|
367
|
+
fxReportMemoryError(parser, parser->line, "number overflow");
|
|
368
|
+
}
|
|
369
|
+
if (c == 'n')
|
|
370
|
+
fxGetNextCharacter(parser);
|
|
371
|
+
if (fxIsIdentifierFirst(parser->character)) {
|
|
372
|
+
fxReportParserError(parser, parser->line, "invalid number");
|
|
373
|
+
}
|
|
374
|
+
*p = 0;
|
|
375
|
+
q = parser->buffer;
|
|
376
|
+
if (c == 'n') {
|
|
377
|
+
parser->bigint2.data = fxNewParserChunk(parser, fxBigIntMaximumB(mxPtrDiff(p - q)));
|
|
378
|
+
fxBigIntParseB(&parser->bigint2, q, mxPtrDiff(p - q));
|
|
379
|
+
parser->token2 = XS_TOKEN_BIGINT;
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
txNumber n = 0;
|
|
383
|
+
while ((c = *q++))
|
|
384
|
+
n = (n * 2) + (c - '0');
|
|
385
|
+
fxGetNextNumber(parser, n);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
void fxGetNextNumberE(txParser* parser, int dot)
|
|
390
|
+
{
|
|
391
|
+
txString p = parser->buffer;
|
|
392
|
+
txString q = p + parser->bufferSize;
|
|
393
|
+
txString r;
|
|
394
|
+
int c;
|
|
395
|
+
if (dot) {
|
|
396
|
+
if (p < q) *p++ = '.';
|
|
397
|
+
}
|
|
398
|
+
p = fxGetNextDigits(parser, fxGetNextDigitsE, p, q, 0);
|
|
399
|
+
if (dot)
|
|
400
|
+
r = p;
|
|
401
|
+
else if (parser->character == '.') {
|
|
402
|
+
dot = 1;
|
|
403
|
+
if (p < q) *p++ = '.';
|
|
404
|
+
fxGetNextCharacter(parser);
|
|
405
|
+
p = fxGetNextDigits(parser, fxGetNextDigitsE, p, q, 0);
|
|
406
|
+
r = p;
|
|
407
|
+
}
|
|
408
|
+
c = parser->character;
|
|
409
|
+
if ((c == 'e') || (c == 'E')) {
|
|
410
|
+
if (dot) {
|
|
411
|
+
if (p == r) {
|
|
412
|
+
if (p < q) *p++ = '0';
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
dot = 1;
|
|
417
|
+
if (p < q) *p++ = '.';
|
|
418
|
+
if (p < q) *p++ = '0';
|
|
419
|
+
}
|
|
420
|
+
if (p < q) *p++ = (char)c;
|
|
421
|
+
fxGetNextCharacter(parser);
|
|
422
|
+
c = parser->character;
|
|
423
|
+
if ((c == '+') || (c == '-')) {
|
|
424
|
+
if (p < q) *p++ = (char)c;
|
|
425
|
+
fxGetNextCharacter(parser);
|
|
426
|
+
c = parser->character;
|
|
427
|
+
}
|
|
428
|
+
p = fxGetNextDigits(parser, fxGetNextDigitsE, p, q, 1);
|
|
429
|
+
c = parser->character;
|
|
430
|
+
}
|
|
431
|
+
if (p == q) {
|
|
432
|
+
fxReportMemoryError(parser, parser->line, "number overflow");
|
|
433
|
+
}
|
|
434
|
+
if (c == 'n')
|
|
435
|
+
fxGetNextCharacter(parser);
|
|
436
|
+
if (fxIsIdentifierFirst(parser->character)) {
|
|
437
|
+
fxReportParserError(parser, parser->line, "invalid number");
|
|
438
|
+
}
|
|
439
|
+
*p = 0;
|
|
440
|
+
q = parser->buffer;
|
|
441
|
+
if (c == 'n') {
|
|
442
|
+
if (dot == 0) {
|
|
443
|
+
parser->bigint2.data = fxNewParserChunk(parser, fxBigIntMaximum(mxPtrDiff(p - q)));
|
|
444
|
+
fxBigIntParse(&parser->bigint2, q, mxPtrDiff(p - q), 0);
|
|
445
|
+
parser->token2 = XS_TOKEN_BIGINT;
|
|
446
|
+
}
|
|
447
|
+
else
|
|
448
|
+
fxReportParserError(parser, parser->line, "invalid number");
|
|
449
|
+
}
|
|
450
|
+
else
|
|
451
|
+
fxGetNextNumber(parser, fxStringToNumber(parser->dtoa, parser->buffer, 1));
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
void fxGetNextNumberO(txParser* parser, int c, int legacy)
|
|
455
|
+
{
|
|
456
|
+
txString p = parser->buffer;
|
|
457
|
+
txString q = p + parser->bufferSize;
|
|
458
|
+
if (legacy) {
|
|
459
|
+
p = fxGetNextDigitsD(parser, p, q, &legacy);
|
|
460
|
+
if (parser->character == '_')
|
|
461
|
+
fxReportParserError(parser, parser->line, "invalid number");
|
|
462
|
+
if (parser->character == 'n')
|
|
463
|
+
fxReportParserError(parser, parser->line, "invalid number");
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
fxGetNextCharacter(parser);
|
|
467
|
+
legacy = 8;
|
|
468
|
+
p = fxGetNextDigits(parser, fxGetNextDigitsO, p, q, 1);
|
|
469
|
+
}
|
|
470
|
+
c = parser->character;
|
|
471
|
+
if (p == q) {
|
|
472
|
+
fxReportMemoryError(parser, parser->line, "number overflow");
|
|
473
|
+
}
|
|
474
|
+
if (c == 'n')
|
|
475
|
+
fxGetNextCharacter(parser);
|
|
476
|
+
if (fxIsIdentifierFirst(parser->character)) {
|
|
477
|
+
fxReportParserError(parser, parser->line, "invalid number");
|
|
478
|
+
}
|
|
479
|
+
*p = 0;
|
|
480
|
+
q = parser->buffer;
|
|
481
|
+
if (c == 'n') {
|
|
482
|
+
parser->bigint2.data = fxNewParserChunk(parser, fxBigIntMaximumO(mxPtrDiff(p - q)));
|
|
483
|
+
fxBigIntParseO(&parser->bigint2, q, mxPtrDiff(p - q));
|
|
484
|
+
parser->token2 = XS_TOKEN_BIGINT;
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
txNumber n = 0;
|
|
488
|
+
while ((c = *q++))
|
|
489
|
+
n = (n * legacy) + (c - '0');
|
|
490
|
+
fxGetNextNumber(parser, n);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
void fxGetNextNumberX(txParser* parser)
|
|
495
|
+
{
|
|
496
|
+
txString p = parser->buffer;
|
|
497
|
+
txString q = p + parser->bufferSize;
|
|
498
|
+
int c;
|
|
499
|
+
fxGetNextCharacter(parser);
|
|
500
|
+
p = fxGetNextDigits(parser, fxGetNextDigitsX, p, q, 1);
|
|
501
|
+
c = parser->character;
|
|
502
|
+
if (p == q) {
|
|
503
|
+
fxReportMemoryError(parser, parser->line, "number overflow");
|
|
504
|
+
}
|
|
505
|
+
if (c == 'n')
|
|
506
|
+
fxGetNextCharacter(parser);
|
|
507
|
+
if (fxIsIdentifierFirst(parser->character)) {
|
|
508
|
+
fxReportParserError(parser, parser->line, "invalid number");
|
|
509
|
+
}
|
|
510
|
+
*p = 0;
|
|
511
|
+
q = parser->buffer;
|
|
512
|
+
if (c == 'n') {
|
|
513
|
+
parser->bigint2.data = fxNewParserChunk(parser, fxBigIntMaximumX(mxPtrDiff(p - q)));
|
|
514
|
+
fxBigIntParseX(&parser->bigint2, q, mxPtrDiff(p - q));
|
|
515
|
+
parser->token2 = XS_TOKEN_BIGINT;
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
txNumber n = 0;
|
|
519
|
+
while ((c = *q++)) {
|
|
520
|
+
if (('0' <= c) && (c <= '9'))
|
|
521
|
+
n = (n * 16) + (c - '0');
|
|
522
|
+
else if (('a' <= c) && (c <= 'f'))
|
|
523
|
+
n = (n * 16) + (10 + c - 'a');
|
|
524
|
+
else
|
|
525
|
+
n = (n * 16) + (10 + c - 'A');
|
|
526
|
+
}
|
|
527
|
+
fxGetNextNumber(parser, n);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
void fxGetNextRegExp(txParser* parser, txU4 c)
|
|
532
|
+
{
|
|
533
|
+
txString p;
|
|
534
|
+
txString q;
|
|
535
|
+
txBoolean backslash = 0;
|
|
536
|
+
txBoolean bracket = 0;
|
|
537
|
+
txBoolean first = 1;
|
|
538
|
+
txBoolean second = 1;
|
|
539
|
+
p = parser->buffer;
|
|
540
|
+
q = p + parser->bufferSize - 1;
|
|
541
|
+
if (!c) {
|
|
542
|
+
c = parser->character;
|
|
543
|
+
second = 0;
|
|
544
|
+
}
|
|
545
|
+
for (;;) {
|
|
546
|
+
if (c == (txU4)C_EOF) {
|
|
547
|
+
fxReportParserError(parser, parser->line, "end of file in regular expression");
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
else if ((c == 10) || (c == 13) || (c == 0x2028) || (c == 0x2029)) {
|
|
551
|
+
fxReportParserError(parser, parser->line, "end of line in regular expression");
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
else if (c == '*') {
|
|
555
|
+
if (first) {
|
|
556
|
+
fxReportParserError(parser, parser->line, "invalid regular expression");
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
backslash = 0;
|
|
560
|
+
}
|
|
561
|
+
else if (c == '\\') {
|
|
562
|
+
if (!backslash)
|
|
563
|
+
backslash = 1;
|
|
564
|
+
else
|
|
565
|
+
backslash = 0;
|
|
566
|
+
}
|
|
567
|
+
else if (c == '[') {
|
|
568
|
+
if (!backslash)
|
|
569
|
+
bracket = 1;
|
|
570
|
+
backslash = 0;
|
|
571
|
+
}
|
|
572
|
+
else if (c == ']') {
|
|
573
|
+
if (!backslash)
|
|
574
|
+
bracket = 0;
|
|
575
|
+
backslash = 0;
|
|
576
|
+
}
|
|
577
|
+
else if (c == '/') {
|
|
578
|
+
if (!backslash && !bracket)
|
|
579
|
+
break;
|
|
580
|
+
backslash = 0;
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
backslash = 0;
|
|
584
|
+
}
|
|
585
|
+
p = fxUTF8Buffer(parser, c, p, q);
|
|
586
|
+
if (second)
|
|
587
|
+
second = 0;
|
|
588
|
+
else
|
|
589
|
+
fxGetNextCharacter(parser);
|
|
590
|
+
c = parser->character;
|
|
591
|
+
first = 0;
|
|
592
|
+
}
|
|
593
|
+
*p = 0;
|
|
594
|
+
parser->stringLength = mxPtrDiff(p - parser->buffer);
|
|
595
|
+
parser->string = fxNewParserString(parser, parser->buffer, parser->stringLength);
|
|
596
|
+
p = parser->buffer;
|
|
597
|
+
q = p + parser->bufferSize - 1;
|
|
598
|
+
for (;;) {
|
|
599
|
+
fxGetNextCharacter(parser);
|
|
600
|
+
if (fxIsIdentifierNext(parser->character))
|
|
601
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
602
|
+
else
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
*p = 0;
|
|
606
|
+
parser->modifierLength = mxPtrDiff(p - parser->buffer);
|
|
607
|
+
parser->modifier = fxNewParserString(parser, parser->buffer, parser->modifierLength);
|
|
608
|
+
if (!fxCompileRegExp(C_NULL, parser->string, parser->modifier, C_NULL, C_NULL, parser->buffer, parser->bufferSize))
|
|
609
|
+
fxReportParserError(parser, parser->line, "%s", parser->buffer);
|
|
610
|
+
parser->token = XS_TOKEN_REGEXP;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
void fxGetNextString(txParser* parser, int c)
|
|
614
|
+
{
|
|
615
|
+
txString p = parser->buffer;
|
|
616
|
+
txString q = p + parser->bufferSize - 1;
|
|
617
|
+
for (;;) {
|
|
618
|
+
if (parser->character == (txU4)C_EOF) {
|
|
619
|
+
fxReportParserError(parser, parser->line, "end of file in string");
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
else if (parser->character == 10) {
|
|
623
|
+
parser->line2++;
|
|
624
|
+
if (c == '`') {
|
|
625
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
626
|
+
fxGetNextCharacter(parser);
|
|
627
|
+
}
|
|
628
|
+
else {
|
|
629
|
+
fxReportParserError(parser, parser->line, "end of line in string");
|
|
630
|
+
break;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
else if (parser->character == 13) {
|
|
634
|
+
parser->line2++;
|
|
635
|
+
if (c == '`') {
|
|
636
|
+
p = fxUTF8Buffer(parser, 10, p, q);
|
|
637
|
+
fxGetNextCharacter(parser);
|
|
638
|
+
if (parser->character == 10)
|
|
639
|
+
fxGetNextCharacter(parser);
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
fxReportParserError(parser, parser->line, "end of line in string");
|
|
643
|
+
break;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
else if ((parser->character == 0x2028) || (parser->character == 0x2029)) {
|
|
647
|
+
parser->line2++;
|
|
648
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
649
|
+
fxGetNextCharacter(parser);
|
|
650
|
+
}
|
|
651
|
+
else if (parser->character == (txU4)c) {
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
else if (parser->character == '$') {
|
|
655
|
+
fxGetNextCharacter(parser);
|
|
656
|
+
if ((c == '`') && (parser->character == '{'))
|
|
657
|
+
break;
|
|
658
|
+
p = fxUTF8Buffer(parser, '$', p, q);
|
|
659
|
+
}
|
|
660
|
+
else if (parser->character == '\\') {
|
|
661
|
+
parser->escaped2 = 1;
|
|
662
|
+
p = fxUTF8Buffer(parser, '\\', p, q);
|
|
663
|
+
fxGetNextCharacter(parser);
|
|
664
|
+
switch (parser->character) {
|
|
665
|
+
case 10:
|
|
666
|
+
case 0x2028:
|
|
667
|
+
case 0x2029:
|
|
668
|
+
parser->line2++;
|
|
669
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
670
|
+
fxGetNextCharacter(parser);
|
|
671
|
+
break;
|
|
672
|
+
case 13:
|
|
673
|
+
parser->line2++;
|
|
674
|
+
p = fxUTF8Buffer(parser, 10, p, q);
|
|
675
|
+
fxGetNextCharacter(parser);
|
|
676
|
+
if (parser->character == 10)
|
|
677
|
+
fxGetNextCharacter(parser);
|
|
678
|
+
break;
|
|
679
|
+
default:
|
|
680
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
681
|
+
fxGetNextCharacter(parser);
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
else {
|
|
686
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
687
|
+
fxGetNextCharacter(parser);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
*p = 0;
|
|
691
|
+
if (p == q) {
|
|
692
|
+
fxReportMemoryError(parser, parser->line, "string overflow");
|
|
693
|
+
}
|
|
694
|
+
parser->rawLength2 = mxPtrDiff(p - parser->buffer);
|
|
695
|
+
parser->raw2 = fxNewParserString(parser, parser->buffer, parser->rawLength2);
|
|
696
|
+
if (parser->escaped2) {
|
|
697
|
+
txInteger character;
|
|
698
|
+
txString s;
|
|
699
|
+
txU1* u;
|
|
700
|
+
p = parser->buffer;
|
|
701
|
+
q = p + parser->bufferSize - 1;
|
|
702
|
+
s = parser->raw2;
|
|
703
|
+
while (*s) {
|
|
704
|
+
if (p == q) {
|
|
705
|
+
fxReportMemoryError(parser, parser->line, "buffer overflow");
|
|
706
|
+
}
|
|
707
|
+
if (*s == '\\') {
|
|
708
|
+
s++;
|
|
709
|
+
switch (*s) {
|
|
710
|
+
case 0:
|
|
711
|
+
break;
|
|
712
|
+
case 10:
|
|
713
|
+
s++;
|
|
714
|
+
break;
|
|
715
|
+
case 13:
|
|
716
|
+
s++;
|
|
717
|
+
if (*s == 10)
|
|
718
|
+
s++;
|
|
719
|
+
break;
|
|
720
|
+
case 'b':
|
|
721
|
+
s++;
|
|
722
|
+
*p++ = '\b';
|
|
723
|
+
break;
|
|
724
|
+
case 'f':
|
|
725
|
+
s++;
|
|
726
|
+
*p++ = '\f';
|
|
727
|
+
break;
|
|
728
|
+
case 'n':
|
|
729
|
+
s++;
|
|
730
|
+
*p++ = '\n';
|
|
731
|
+
break;
|
|
732
|
+
case 'r':
|
|
733
|
+
s++;
|
|
734
|
+
*p++ = '\r';
|
|
735
|
+
break;
|
|
736
|
+
case 't':
|
|
737
|
+
s++;
|
|
738
|
+
*p++ = '\t';
|
|
739
|
+
break;
|
|
740
|
+
case 'v':
|
|
741
|
+
s++;
|
|
742
|
+
*p++ = '\v';
|
|
743
|
+
break;
|
|
744
|
+
case 'x':
|
|
745
|
+
s++;
|
|
746
|
+
if (fxParseHexEscape(&s, &character))
|
|
747
|
+
p = fxUTF8Buffer(parser, character, p, q);
|
|
748
|
+
else
|
|
749
|
+
parser->escaped2 |= mxStringErrorFlag;
|
|
750
|
+
break;
|
|
751
|
+
case 'u':
|
|
752
|
+
s++;
|
|
753
|
+
if (fxParseUnicodeEscape(&s, &character, 1, '\\'))
|
|
754
|
+
p = fxUTF8Buffer(parser, character, p, q);
|
|
755
|
+
else
|
|
756
|
+
parser->escaped2 |= mxStringErrorFlag;
|
|
757
|
+
break;
|
|
758
|
+
case '0':
|
|
759
|
+
case '1':
|
|
760
|
+
case '2':
|
|
761
|
+
case '3':
|
|
762
|
+
case '4':
|
|
763
|
+
case '5':
|
|
764
|
+
case '6':
|
|
765
|
+
case '7':
|
|
766
|
+
character = *s++ - '0';
|
|
767
|
+
if ((character == 0) && ((*s < '0') || ('9' < *s)))
|
|
768
|
+
p = fxUTF8Buffer(parser, character, p, q);
|
|
769
|
+
else {
|
|
770
|
+
parser->escaped2 |= mxStringLegacyFlag;
|
|
771
|
+
if ((0 <= character) && (character <= 3)) {
|
|
772
|
+
if (('0' <= *s) && (*s <= '7'))
|
|
773
|
+
character = (character * 8) + *s++ - '0';
|
|
774
|
+
}
|
|
775
|
+
if (('0' <= *s) && (*s <= '7'))
|
|
776
|
+
character = (character * 8) + *s++ - '0';
|
|
777
|
+
p = fxUTF8Buffer(parser, character, p, q);
|
|
778
|
+
}
|
|
779
|
+
break;
|
|
780
|
+
case '8':
|
|
781
|
+
case '9':
|
|
782
|
+
parser->escaped2 |= mxStringLegacyFlag;
|
|
783
|
+
*p++ = *s++;
|
|
784
|
+
break;
|
|
785
|
+
default:
|
|
786
|
+
u = (txU1*)s;
|
|
787
|
+
if ((u[0] == 0xE2) && (u[1] == 0x80) && ((u[2] == 0xA8) || (u[2] == 0xA9))) { /* LS || PS */
|
|
788
|
+
s += 3;
|
|
789
|
+
}
|
|
790
|
+
else
|
|
791
|
+
*p++ = *s++;
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
*p++ = *s++;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
*p = 0;
|
|
800
|
+
parser->stringLength2 = mxPtrDiff(p - parser->buffer);
|
|
801
|
+
parser->string2 = fxNewParserString(parser, parser->buffer, parser->stringLength2);
|
|
802
|
+
if ((c == '`') && (parser->escaped2 & mxStringLegacyFlag))
|
|
803
|
+
parser->escaped2 |= mxStringErrorFlag;
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
parser->stringLength2 = parser->rawLength2;
|
|
807
|
+
parser->string2 = parser->raw2;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
txBoolean fxGetNextStringD(int c, txU4* value)
|
|
812
|
+
{
|
|
813
|
+
if (('0' <= c) && (c <= '9'))
|
|
814
|
+
*value = (*value * 10) + (c - '0');
|
|
815
|
+
else
|
|
816
|
+
return 0;
|
|
817
|
+
return 1;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
txBoolean fxGetNextStringX(int c, txU4* value)
|
|
821
|
+
{
|
|
822
|
+
if (('0' <= c) && (c <= '9'))
|
|
823
|
+
*value = (*value * 16) + (c - '0');
|
|
824
|
+
else if (('a' <= c) && (c <= 'f'))
|
|
825
|
+
*value = (*value * 16) + (10 + c - 'a');
|
|
826
|
+
else if (('A' <= c) && (c <= 'F'))
|
|
827
|
+
*value = (*value * 16) + (10 + c - 'A');
|
|
828
|
+
else
|
|
829
|
+
return 0;
|
|
830
|
+
return 1;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
void fxGetNextToken(txParser* parser)
|
|
834
|
+
{
|
|
835
|
+
if (!parser->ahead)
|
|
836
|
+
fxGetNextTokenAux(parser);
|
|
837
|
+
parser->line = parser->line2;
|
|
838
|
+
parser->crlf = parser->crlf2;
|
|
839
|
+
parser->escaped = parser->escaped2;
|
|
840
|
+
parser->bigint = parser->bigint2;
|
|
841
|
+
parser->integer = parser->integer2;
|
|
842
|
+
parser->modifierLength = parser->modifierLength2;
|
|
843
|
+
parser->modifier = parser->modifier2;
|
|
844
|
+
parser->number = parser->number2;
|
|
845
|
+
parser->rawLength = parser->rawLength2;
|
|
846
|
+
parser->raw = parser->raw2;
|
|
847
|
+
parser->stringLength = parser->stringLength2;
|
|
848
|
+
parser->string = parser->string2;
|
|
849
|
+
parser->symbol = parser->symbol2;
|
|
850
|
+
parser->token = parser->token2;
|
|
851
|
+
parser->ahead = 0;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
void fxGetNextToken2(txParser* parser)
|
|
855
|
+
{
|
|
856
|
+
if (!parser->ahead)
|
|
857
|
+
fxGetNextTokenAux(parser);
|
|
858
|
+
parser->ahead = 1;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
void fxGetNextTokenAux(txParser* parser)
|
|
862
|
+
{
|
|
863
|
+
int c;
|
|
864
|
+
txString p;
|
|
865
|
+
txString q;
|
|
866
|
+
txU4 t = 0;
|
|
867
|
+
parser->crlf2 = 0;
|
|
868
|
+
parser->escaped2 = 0;
|
|
869
|
+
parser->bigint2.data = C_NULL;
|
|
870
|
+
parser->bigint2.size = 0;
|
|
871
|
+
parser->bigint2.sign = 0;
|
|
872
|
+
parser->integer2 = 0;
|
|
873
|
+
parser->modifierLength2 = 0;
|
|
874
|
+
parser->modifier2 = parser->emptyString;
|
|
875
|
+
parser->number2 = 0;
|
|
876
|
+
parser->rawLength2 = 0;
|
|
877
|
+
parser->raw2 = parser->emptyString;
|
|
878
|
+
parser->stringLength2 = 0;
|
|
879
|
+
parser->string2 = parser->emptyString;
|
|
880
|
+
parser->symbol2 = C_NULL;
|
|
881
|
+
parser->token2 = XS_NO_TOKEN;
|
|
882
|
+
while (parser->token2 == XS_NO_TOKEN) {
|
|
883
|
+
switch (parser->character) {
|
|
884
|
+
case C_EOF:
|
|
885
|
+
parser->token2 = XS_TOKEN_EOF;
|
|
886
|
+
break;
|
|
887
|
+
case 10:
|
|
888
|
+
case 0x2028: // <LS>
|
|
889
|
+
case 0x2029: // <PS>
|
|
890
|
+
parser->line2++;
|
|
891
|
+
fxGetNextCharacter(parser);
|
|
892
|
+
parser->crlf2 = 1;
|
|
893
|
+
break;
|
|
894
|
+
case 13:
|
|
895
|
+
parser->line2++;
|
|
896
|
+
fxGetNextCharacter(parser);
|
|
897
|
+
if (parser->character == 10)
|
|
898
|
+
fxGetNextCharacter(parser);
|
|
899
|
+
parser->crlf2 = 1;
|
|
900
|
+
break;
|
|
901
|
+
|
|
902
|
+
case '\t':
|
|
903
|
+
case 11:
|
|
904
|
+
case 12:
|
|
905
|
+
case ' ':
|
|
906
|
+
case 0x00A0:
|
|
907
|
+
case 0x1680:
|
|
908
|
+
case 0x2000:
|
|
909
|
+
case 0x2001:
|
|
910
|
+
case 0x2002:
|
|
911
|
+
case 0x2003:
|
|
912
|
+
case 0x2004:
|
|
913
|
+
case 0x2005:
|
|
914
|
+
case 0x2006:
|
|
915
|
+
case 0x2007:
|
|
916
|
+
case 0x2008:
|
|
917
|
+
case 0x2009:
|
|
918
|
+
case 0x200A:
|
|
919
|
+
case 0x202F:
|
|
920
|
+
case 0x205F:
|
|
921
|
+
case 0x3000:
|
|
922
|
+
case 0xFEFF:
|
|
923
|
+
fxGetNextCharacter(parser);
|
|
924
|
+
break;
|
|
925
|
+
|
|
926
|
+
case '0':
|
|
927
|
+
fxGetNextCharacter(parser);
|
|
928
|
+
c = parser->character;
|
|
929
|
+
if (c == '.') {
|
|
930
|
+
fxGetNextCharacter(parser);
|
|
931
|
+
c = parser->character;
|
|
932
|
+
if ((('0' <= c) && (c <= '9')) || (c == 'e') || (c == 'E'))
|
|
933
|
+
fxGetNextNumberE(parser, 1);
|
|
934
|
+
else {
|
|
935
|
+
parser->number2 = 0;
|
|
936
|
+
parser->token2 = XS_TOKEN_NUMBER;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
else if ((c == 'b') || (c == 'B')) {
|
|
940
|
+
fxGetNextNumberB(parser);
|
|
941
|
+
}
|
|
942
|
+
else if ((c == 'e') || (c == 'E')) {
|
|
943
|
+
fxGetNextNumberE(parser, 0);
|
|
944
|
+
}
|
|
945
|
+
else if (c == 'n') {
|
|
946
|
+
fxGetNextNumberE(parser, 0);
|
|
947
|
+
}
|
|
948
|
+
else if ((c == 'o') || (c == 'O')) {
|
|
949
|
+
fxGetNextNumberO(parser, '0', 0);
|
|
950
|
+
}
|
|
951
|
+
else if ((c == 'x') || (c == 'X')) {
|
|
952
|
+
fxGetNextNumberX(parser);
|
|
953
|
+
}
|
|
954
|
+
else if (('0' <= c) && (c <= '9')) {
|
|
955
|
+
if ((parser->flags & mxStrictFlag))
|
|
956
|
+
fxReportParserError(parser, parser->line, "octal number (strict mode)");
|
|
957
|
+
fxGetNextNumberO(parser, c, 1);
|
|
958
|
+
}
|
|
959
|
+
else {
|
|
960
|
+
parser->integer2 = 0;
|
|
961
|
+
parser->token2 = XS_TOKEN_INTEGER;
|
|
962
|
+
}
|
|
963
|
+
break;
|
|
964
|
+
case '1':
|
|
965
|
+
case '2':
|
|
966
|
+
case '3':
|
|
967
|
+
case '4':
|
|
968
|
+
case '5':
|
|
969
|
+
case '6':
|
|
970
|
+
case '7':
|
|
971
|
+
case '8':
|
|
972
|
+
case '9':
|
|
973
|
+
fxGetNextNumberE(parser, 0);
|
|
974
|
+
break;
|
|
975
|
+
case '.':
|
|
976
|
+
fxGetNextCharacter(parser);
|
|
977
|
+
c = parser->character;
|
|
978
|
+
if (c == '.') {
|
|
979
|
+
fxGetNextCharacter(parser);
|
|
980
|
+
if (parser->character == '.') {
|
|
981
|
+
parser->token2 = XS_TOKEN_SPREAD;
|
|
982
|
+
fxGetNextCharacter(parser);
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
fxReportParserError(parser, parser->line, "invalid character %d", parser->character);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
else if (('0' <= c) && (c <= '9'))
|
|
989
|
+
fxGetNextNumberE(parser, 1);
|
|
990
|
+
else
|
|
991
|
+
parser->token2 = XS_TOKEN_DOT;
|
|
992
|
+
break;
|
|
993
|
+
case ',':
|
|
994
|
+
parser->token2 = XS_TOKEN_COMMA;
|
|
995
|
+
fxGetNextCharacter(parser);
|
|
996
|
+
break;
|
|
997
|
+
case ';':
|
|
998
|
+
parser->token2 = XS_TOKEN_SEMICOLON;
|
|
999
|
+
fxGetNextCharacter(parser);
|
|
1000
|
+
break;
|
|
1001
|
+
case ':':
|
|
1002
|
+
parser->token2 = XS_TOKEN_COLON;
|
|
1003
|
+
fxGetNextCharacter(parser);
|
|
1004
|
+
break;
|
|
1005
|
+
case '?':
|
|
1006
|
+
fxGetNextCharacter(parser);
|
|
1007
|
+
if (parser->character == '.') {
|
|
1008
|
+
if ((parser->lookahead < '0') || ('9' < parser->lookahead)) {
|
|
1009
|
+
parser->token2 = XS_TOKEN_CHAIN;
|
|
1010
|
+
fxGetNextCharacter(parser);
|
|
1011
|
+
}
|
|
1012
|
+
else
|
|
1013
|
+
parser->token2 = XS_TOKEN_QUESTION_MARK;
|
|
1014
|
+
}
|
|
1015
|
+
else if (parser->character == '?') {
|
|
1016
|
+
parser->token2 = XS_TOKEN_COALESCE;
|
|
1017
|
+
fxGetNextCharacter(parser);
|
|
1018
|
+
if (parser->character == '=') {
|
|
1019
|
+
parser->token2 = XS_TOKEN_COALESCE_ASSIGN;
|
|
1020
|
+
fxGetNextCharacter(parser);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
else
|
|
1024
|
+
parser->token2 = XS_TOKEN_QUESTION_MARK;
|
|
1025
|
+
break;
|
|
1026
|
+
case '(':
|
|
1027
|
+
parser->token2 = XS_TOKEN_LEFT_PARENTHESIS;
|
|
1028
|
+
fxGetNextCharacter(parser);
|
|
1029
|
+
break;
|
|
1030
|
+
case ')':
|
|
1031
|
+
parser->token2 = XS_TOKEN_RIGHT_PARENTHESIS;
|
|
1032
|
+
fxGetNextCharacter(parser);
|
|
1033
|
+
break;
|
|
1034
|
+
case '[':
|
|
1035
|
+
parser->token2 = XS_TOKEN_LEFT_BRACKET;
|
|
1036
|
+
fxGetNextCharacter(parser);
|
|
1037
|
+
break;
|
|
1038
|
+
case ']':
|
|
1039
|
+
parser->token2 = XS_TOKEN_RIGHT_BRACKET;
|
|
1040
|
+
fxGetNextCharacter(parser);
|
|
1041
|
+
break;
|
|
1042
|
+
case '{':
|
|
1043
|
+
parser->token2 = XS_TOKEN_LEFT_BRACE;
|
|
1044
|
+
fxGetNextCharacter(parser);
|
|
1045
|
+
break;
|
|
1046
|
+
case '}':
|
|
1047
|
+
parser->token2 = XS_TOKEN_RIGHT_BRACE;
|
|
1048
|
+
fxGetNextCharacter(parser);
|
|
1049
|
+
break;
|
|
1050
|
+
case '=':
|
|
1051
|
+
fxGetNextCharacter(parser);
|
|
1052
|
+
if (parser->character == '=') {
|
|
1053
|
+
fxGetNextCharacter(parser);
|
|
1054
|
+
if (parser->character == '=') {
|
|
1055
|
+
parser->token2 = XS_TOKEN_STRICT_EQUAL;
|
|
1056
|
+
fxGetNextCharacter(parser);
|
|
1057
|
+
}
|
|
1058
|
+
else
|
|
1059
|
+
parser->token2 = XS_TOKEN_EQUAL;
|
|
1060
|
+
}
|
|
1061
|
+
else if (parser->character == '>') {
|
|
1062
|
+
parser->token2 = XS_TOKEN_ARROW;
|
|
1063
|
+
fxGetNextCharacter(parser);
|
|
1064
|
+
}
|
|
1065
|
+
else
|
|
1066
|
+
parser->token2 = XS_TOKEN_ASSIGN;
|
|
1067
|
+
break;
|
|
1068
|
+
case '<':
|
|
1069
|
+
fxGetNextCharacter(parser);
|
|
1070
|
+
if (parser->character == '<') {
|
|
1071
|
+
fxGetNextCharacter(parser);
|
|
1072
|
+
if (parser->character == '=') {
|
|
1073
|
+
parser->token2 = XS_TOKEN_LEFT_SHIFT_ASSIGN;
|
|
1074
|
+
fxGetNextCharacter(parser);
|
|
1075
|
+
}
|
|
1076
|
+
else
|
|
1077
|
+
parser->token2 = XS_TOKEN_LEFT_SHIFT;
|
|
1078
|
+
}
|
|
1079
|
+
else if (parser->character == '=') {
|
|
1080
|
+
parser->token2 = XS_TOKEN_LESS_EQUAL;
|
|
1081
|
+
fxGetNextCharacter(parser);
|
|
1082
|
+
}
|
|
1083
|
+
else
|
|
1084
|
+
parser->token2 = XS_TOKEN_LESS;
|
|
1085
|
+
break;
|
|
1086
|
+
case '>':
|
|
1087
|
+
fxGetNextCharacter(parser);
|
|
1088
|
+
if (parser->character == '>') {
|
|
1089
|
+
fxGetNextCharacter(parser);
|
|
1090
|
+
if (parser->character == '>') {
|
|
1091
|
+
fxGetNextCharacter(parser);
|
|
1092
|
+
if (parser->character == '=') {
|
|
1093
|
+
parser->token2 = XS_TOKEN_UNSIGNED_RIGHT_SHIFT_ASSIGN;
|
|
1094
|
+
fxGetNextCharacter(parser);
|
|
1095
|
+
}
|
|
1096
|
+
else
|
|
1097
|
+
parser->token2 = XS_TOKEN_UNSIGNED_RIGHT_SHIFT;
|
|
1098
|
+
}
|
|
1099
|
+
else if (parser->character == '=') {
|
|
1100
|
+
parser->token2 = XS_TOKEN_SIGNED_RIGHT_SHIFT_ASSIGN;
|
|
1101
|
+
fxGetNextCharacter(parser);
|
|
1102
|
+
}
|
|
1103
|
+
else
|
|
1104
|
+
parser->token2 = XS_TOKEN_SIGNED_RIGHT_SHIFT;
|
|
1105
|
+
}
|
|
1106
|
+
else if (parser->character == '=') {
|
|
1107
|
+
parser->token2 = XS_TOKEN_MORE_EQUAL;
|
|
1108
|
+
fxGetNextCharacter(parser);
|
|
1109
|
+
}
|
|
1110
|
+
else
|
|
1111
|
+
parser->token2 = XS_TOKEN_MORE;
|
|
1112
|
+
break;
|
|
1113
|
+
case '!':
|
|
1114
|
+
fxGetNextCharacter(parser);
|
|
1115
|
+
if (parser->character == '=') {
|
|
1116
|
+
fxGetNextCharacter(parser);
|
|
1117
|
+
if (parser->character == '=') {
|
|
1118
|
+
parser->token2 = XS_TOKEN_STRICT_NOT_EQUAL;
|
|
1119
|
+
fxGetNextCharacter(parser);
|
|
1120
|
+
}
|
|
1121
|
+
else
|
|
1122
|
+
parser->token2 = XS_TOKEN_NOT_EQUAL;
|
|
1123
|
+
}
|
|
1124
|
+
else
|
|
1125
|
+
parser->token2 = XS_TOKEN_NOT;
|
|
1126
|
+
break;
|
|
1127
|
+
case '~':
|
|
1128
|
+
parser->token2 = XS_TOKEN_BIT_NOT;
|
|
1129
|
+
fxGetNextCharacter(parser);
|
|
1130
|
+
break;
|
|
1131
|
+
case '&':
|
|
1132
|
+
fxGetNextCharacter(parser);
|
|
1133
|
+
if (parser->character == '=') {
|
|
1134
|
+
parser->token2 = XS_TOKEN_BIT_AND_ASSIGN;
|
|
1135
|
+
fxGetNextCharacter(parser);
|
|
1136
|
+
}
|
|
1137
|
+
else if (parser->character == '&') {
|
|
1138
|
+
parser->token2 = XS_TOKEN_AND;
|
|
1139
|
+
fxGetNextCharacter(parser);
|
|
1140
|
+
if (parser->character == '=') {
|
|
1141
|
+
parser->token2 = XS_TOKEN_AND_ASSIGN;
|
|
1142
|
+
fxGetNextCharacter(parser);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
else
|
|
1146
|
+
parser->token2 = XS_TOKEN_BIT_AND;
|
|
1147
|
+
break;
|
|
1148
|
+
case '|':
|
|
1149
|
+
fxGetNextCharacter(parser);
|
|
1150
|
+
if (parser->character == '=') {
|
|
1151
|
+
parser->token2 = XS_TOKEN_BIT_OR_ASSIGN;
|
|
1152
|
+
fxGetNextCharacter(parser);
|
|
1153
|
+
}
|
|
1154
|
+
else if (parser->character == '|') {
|
|
1155
|
+
parser->token2 = XS_TOKEN_OR;
|
|
1156
|
+
fxGetNextCharacter(parser);
|
|
1157
|
+
if (parser->character == '=') {
|
|
1158
|
+
parser->token2 = XS_TOKEN_OR_ASSIGN;
|
|
1159
|
+
fxGetNextCharacter(parser);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
else
|
|
1163
|
+
parser->token2 = XS_TOKEN_BIT_OR;
|
|
1164
|
+
break;
|
|
1165
|
+
case '^':
|
|
1166
|
+
fxGetNextCharacter(parser);
|
|
1167
|
+
if (parser->character == '=') {
|
|
1168
|
+
parser->token2 = XS_TOKEN_BIT_XOR_ASSIGN;
|
|
1169
|
+
fxGetNextCharacter(parser);
|
|
1170
|
+
}
|
|
1171
|
+
else
|
|
1172
|
+
parser->token2 = XS_TOKEN_BIT_XOR;
|
|
1173
|
+
break;
|
|
1174
|
+
case '+':
|
|
1175
|
+
fxGetNextCharacter(parser);
|
|
1176
|
+
if (parser->character == '=') {
|
|
1177
|
+
parser->token2 = XS_TOKEN_ADD_ASSIGN;
|
|
1178
|
+
fxGetNextCharacter(parser);
|
|
1179
|
+
}
|
|
1180
|
+
else if (parser->character == '+') {
|
|
1181
|
+
parser->token2 = XS_TOKEN_INCREMENT;
|
|
1182
|
+
fxGetNextCharacter(parser);
|
|
1183
|
+
}
|
|
1184
|
+
else
|
|
1185
|
+
parser->token2 = XS_TOKEN_ADD;
|
|
1186
|
+
break;
|
|
1187
|
+
case '-':
|
|
1188
|
+
fxGetNextCharacter(parser);
|
|
1189
|
+
if (parser->character == '=') {
|
|
1190
|
+
parser->token2 = XS_TOKEN_SUBTRACT_ASSIGN;
|
|
1191
|
+
fxGetNextCharacter(parser);
|
|
1192
|
+
}
|
|
1193
|
+
else if (parser->character == '-') {
|
|
1194
|
+
parser->token2 = XS_TOKEN_DECREMENT;
|
|
1195
|
+
fxGetNextCharacter(parser);
|
|
1196
|
+
}
|
|
1197
|
+
else
|
|
1198
|
+
parser->token2 = XS_TOKEN_SUBTRACT;
|
|
1199
|
+
break;
|
|
1200
|
+
case '*':
|
|
1201
|
+
fxGetNextCharacter(parser);
|
|
1202
|
+
if (parser->character == '=') {
|
|
1203
|
+
parser->token2 = XS_TOKEN_MULTIPLY_ASSIGN;
|
|
1204
|
+
fxGetNextCharacter(parser);
|
|
1205
|
+
}
|
|
1206
|
+
else if (parser->character == '*') {
|
|
1207
|
+
fxGetNextCharacter(parser);
|
|
1208
|
+
if (parser->character == '=') {
|
|
1209
|
+
parser->token2 = XS_TOKEN_EXPONENTIATION_ASSIGN;
|
|
1210
|
+
fxGetNextCharacter(parser);
|
|
1211
|
+
}
|
|
1212
|
+
else
|
|
1213
|
+
parser->token2 = XS_TOKEN_EXPONENTIATION;
|
|
1214
|
+
}
|
|
1215
|
+
else
|
|
1216
|
+
parser->token2 = XS_TOKEN_MULTIPLY;
|
|
1217
|
+
break;
|
|
1218
|
+
case '/':
|
|
1219
|
+
fxGetNextCharacter(parser);
|
|
1220
|
+
if (parser->character == '*') {
|
|
1221
|
+
fxGetNextCharacter(parser);
|
|
1222
|
+
for (;;) {
|
|
1223
|
+
if (parser->character == (txU4)C_EOF) {
|
|
1224
|
+
fxReportParserError(parser, parser->line, "end of file in comment");
|
|
1225
|
+
break;
|
|
1226
|
+
}
|
|
1227
|
+
else if ((parser->character == 10) || (parser->character == 0x2028) || (parser->character == 0x2029)) {
|
|
1228
|
+
parser->line2++;
|
|
1229
|
+
fxGetNextCharacter(parser);
|
|
1230
|
+
parser->crlf2 = 1;
|
|
1231
|
+
}
|
|
1232
|
+
else if (parser->character == 13) {
|
|
1233
|
+
parser->line2++;
|
|
1234
|
+
fxGetNextCharacter(parser);
|
|
1235
|
+
if (parser->character == 10)
|
|
1236
|
+
fxGetNextCharacter(parser);
|
|
1237
|
+
parser->crlf2 = 1;
|
|
1238
|
+
}
|
|
1239
|
+
else if (parser->character == '*') {
|
|
1240
|
+
fxGetNextCharacter(parser);
|
|
1241
|
+
if (parser->character == '/') {
|
|
1242
|
+
fxGetNextCharacter(parser);
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
else
|
|
1247
|
+
fxGetNextCharacter(parser);
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
else if (parser->character == '/') {
|
|
1251
|
+
fxGetNextCharacter(parser);
|
|
1252
|
+
p = parser->buffer;
|
|
1253
|
+
q = p + parser->bufferSize - 1;
|
|
1254
|
+
while ((parser->character != (txU4)C_EOF) && (parser->character != 10) && (parser->character != 13) && (parser->character != 0x2028) && (parser->character != 0x2029)) {
|
|
1255
|
+
if (p < q)
|
|
1256
|
+
*p++ = (char)parser->character;
|
|
1257
|
+
fxGetNextCharacter(parser);
|
|
1258
|
+
}
|
|
1259
|
+
*p = 0;
|
|
1260
|
+
p = parser->buffer;
|
|
1261
|
+
if ((*p == '#') || (*p == '@')) {
|
|
1262
|
+
if (!c_strncmp(p, "@line ", 6)) {
|
|
1263
|
+
p += 6;
|
|
1264
|
+
t = 0;
|
|
1265
|
+
c = *p++;
|
|
1266
|
+
while (('0' <= c) && (c <= '9')) {
|
|
1267
|
+
t = (t * 10) + (c - '0');
|
|
1268
|
+
c = *p++;
|
|
1269
|
+
}
|
|
1270
|
+
if (!t) goto bail;
|
|
1271
|
+
if (c == ' ') {
|
|
1272
|
+
c = *p++;
|
|
1273
|
+
if (c != '"') goto bail;
|
|
1274
|
+
q = p;
|
|
1275
|
+
c = *q++;
|
|
1276
|
+
while ((c != 0) && (c != 10) && (c != 13) && (c != '"'))
|
|
1277
|
+
c = *q++;
|
|
1278
|
+
if (c != '"') goto bail;
|
|
1279
|
+
*(--q) = 0;
|
|
1280
|
+
parser->path = fxNewParserSymbol(parser, p);
|
|
1281
|
+
}
|
|
1282
|
+
parser->line2 = t - 1;
|
|
1283
|
+
}
|
|
1284
|
+
else if (!c_strncmp(p, "# sourceMappingURL=", 19) || !c_strncmp(p, "@ sourceMappingURL=", 19)) {
|
|
1285
|
+
p += 19;
|
|
1286
|
+
q = p;
|
|
1287
|
+
while (((c = *q)) && (c != 10) && (c != 13))
|
|
1288
|
+
q++;
|
|
1289
|
+
*q = 0;
|
|
1290
|
+
parser->name = fxNewParserString(parser, p, mxPtrDiff(q - p));
|
|
1291
|
+
}
|
|
1292
|
+
else if (!c_strncmp(p, "# sourceURL=", 12) || !c_strncmp(p, "@ sourceURL=", 12)) {
|
|
1293
|
+
p += 12;
|
|
1294
|
+
q = p;
|
|
1295
|
+
while (((c = *q)) && (c != 10) && (c != 13))
|
|
1296
|
+
q++;
|
|
1297
|
+
*q = 0;
|
|
1298
|
+
parser->source = fxNewParserSymbol(parser, p);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
bail:
|
|
1302
|
+
;
|
|
1303
|
+
}
|
|
1304
|
+
else if (parser->character == '=') {
|
|
1305
|
+
parser->token2 = XS_TOKEN_DIVIDE_ASSIGN;
|
|
1306
|
+
fxGetNextCharacter(parser);
|
|
1307
|
+
}
|
|
1308
|
+
else
|
|
1309
|
+
parser->token2 = XS_TOKEN_DIVIDE;
|
|
1310
|
+
break;
|
|
1311
|
+
case '%':
|
|
1312
|
+
fxGetNextCharacter(parser);
|
|
1313
|
+
if (parser->character == '=') {
|
|
1314
|
+
parser->token2 = XS_TOKEN_MODULO_ASSIGN;
|
|
1315
|
+
fxGetNextCharacter(parser);
|
|
1316
|
+
}
|
|
1317
|
+
else
|
|
1318
|
+
parser->token2 = XS_TOKEN_MODULO;
|
|
1319
|
+
break;
|
|
1320
|
+
|
|
1321
|
+
case '"':
|
|
1322
|
+
case '\'':
|
|
1323
|
+
c = parser->character;
|
|
1324
|
+
fxGetNextCharacter(parser);
|
|
1325
|
+
fxGetNextString(parser, c);
|
|
1326
|
+
parser->token2 = XS_TOKEN_STRING;
|
|
1327
|
+
fxGetNextCharacter(parser);
|
|
1328
|
+
break;
|
|
1329
|
+
|
|
1330
|
+
case '`':
|
|
1331
|
+
fxGetNextCharacter(parser);
|
|
1332
|
+
fxGetNextString(parser, '`');
|
|
1333
|
+
if (parser->character == '{')
|
|
1334
|
+
parser->token2 = XS_TOKEN_TEMPLATE_HEAD;
|
|
1335
|
+
else
|
|
1336
|
+
parser->token2 = XS_TOKEN_TEMPLATE;
|
|
1337
|
+
fxGetNextCharacter(parser);
|
|
1338
|
+
break;
|
|
1339
|
+
|
|
1340
|
+
case '@':
|
|
1341
|
+
if (parser->flags & mxCFlag)
|
|
1342
|
+
parser->token2 = XS_TOKEN_HOST;
|
|
1343
|
+
else
|
|
1344
|
+
fxReportParserError(parser, parser->line, "invalid character @");
|
|
1345
|
+
fxGetNextCharacter(parser);
|
|
1346
|
+
break;
|
|
1347
|
+
|
|
1348
|
+
default:
|
|
1349
|
+
p = parser->buffer;
|
|
1350
|
+
q = p + parser->bufferSize - 1;
|
|
1351
|
+
if (parser->character == '#') {
|
|
1352
|
+
*p++ = '#';
|
|
1353
|
+
fxGetNextCharacter(parser);
|
|
1354
|
+
}
|
|
1355
|
+
if (fxIsIdentifierFirst(parser->character)) {
|
|
1356
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1357
|
+
fxGetNextCharacter(parser);
|
|
1358
|
+
}
|
|
1359
|
+
else if (parser->character == '\\') {
|
|
1360
|
+
parser->escaped2 = 1;
|
|
1361
|
+
t = 0;
|
|
1362
|
+
if (fxGetNextIdentiferX(parser, &t) && fxIsIdentifierFirst(t))
|
|
1363
|
+
p = fxUTF8Buffer(parser, t, p, q);
|
|
1364
|
+
else
|
|
1365
|
+
p = C_NULL;
|
|
1366
|
+
}
|
|
1367
|
+
else
|
|
1368
|
+
p = C_NULL;
|
|
1369
|
+
if (p) {
|
|
1370
|
+
for (;;) {
|
|
1371
|
+
if (p == q) {
|
|
1372
|
+
fxReportMemoryError(parser, parser->line, "identifier overflow");
|
|
1373
|
+
}
|
|
1374
|
+
if (fxIsIdentifierNext(parser->character)) {
|
|
1375
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1376
|
+
fxGetNextCharacter(parser);
|
|
1377
|
+
}
|
|
1378
|
+
else if (parser->character == '\\') {
|
|
1379
|
+
parser->escaped2 = 1;
|
|
1380
|
+
t = 0;
|
|
1381
|
+
if (fxGetNextIdentiferX(parser, &t) && fxIsIdentifierNext(t))
|
|
1382
|
+
p = fxUTF8Buffer(parser, t, p, q);
|
|
1383
|
+
else {
|
|
1384
|
+
p = C_NULL;
|
|
1385
|
+
break;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
else {
|
|
1389
|
+
*p = 0;
|
|
1390
|
+
if (parser->buffer[0] == '#') {
|
|
1391
|
+
parser->symbol2 = fxNewParserSymbol(parser, parser->buffer);
|
|
1392
|
+
parser->token2 = XS_TOKEN_PRIVATE_IDENTIFIER;
|
|
1393
|
+
}
|
|
1394
|
+
else {
|
|
1395
|
+
fxGetNextKeyword(parser);
|
|
1396
|
+
}
|
|
1397
|
+
break;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
if (!p) {
|
|
1402
|
+
fxReportParserError(parser, parser->line, "invalid character %d", parser->character);
|
|
1403
|
+
fxGetNextCharacter(parser);
|
|
1404
|
+
}
|
|
1405
|
+
break;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
void fxGetNextTokenTemplate(txParser* parser)
|
|
1411
|
+
{
|
|
1412
|
+
parser->crlf2 = 0;
|
|
1413
|
+
parser->escaped2 = 0;
|
|
1414
|
+
parser->integer2 = 0;
|
|
1415
|
+
parser->modifierLength2 = 0;
|
|
1416
|
+
parser->modifier2 = parser->emptyString;
|
|
1417
|
+
parser->number2 = 0;
|
|
1418
|
+
parser->rawLength2 = 0;
|
|
1419
|
+
parser->raw2 = parser->emptyString;
|
|
1420
|
+
parser->stringLength2 = 0;
|
|
1421
|
+
parser->string2 = parser->emptyString;
|
|
1422
|
+
parser->symbol2 = C_NULL;
|
|
1423
|
+
parser->token2 = XS_NO_TOKEN;
|
|
1424
|
+
fxGetNextString(parser, '`');
|
|
1425
|
+
if (parser->character == '{')
|
|
1426
|
+
parser->token2 = XS_TOKEN_TEMPLATE_MIDDLE;
|
|
1427
|
+
else
|
|
1428
|
+
parser->token2 = XS_TOKEN_TEMPLATE_TAIL;
|
|
1429
|
+
fxGetNextCharacter(parser);
|
|
1430
|
+
parser->line = parser->line2;
|
|
1431
|
+
parser->crlf = parser->crlf2;
|
|
1432
|
+
parser->escaped = parser->escaped2;
|
|
1433
|
+
parser->integer = parser->integer2;
|
|
1434
|
+
parser->modifierLength = parser->modifierLength2;
|
|
1435
|
+
parser->modifier = parser->modifier2;
|
|
1436
|
+
parser->number = parser->number2;
|
|
1437
|
+
parser->rawLength = parser->rawLength2;
|
|
1438
|
+
parser->raw = parser->raw2;
|
|
1439
|
+
parser->stringLength = parser->stringLength2;
|
|
1440
|
+
parser->string = parser->string2;
|
|
1441
|
+
parser->symbol = parser->symbol2;
|
|
1442
|
+
parser->token = parser->token2;
|
|
1443
|
+
parser->ahead = 0;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
void fxGetNextTokenJSON(txParser* parser)
|
|
1447
|
+
{
|
|
1448
|
+
int c;
|
|
1449
|
+
txString p;
|
|
1450
|
+
txString q;
|
|
1451
|
+
|
|
1452
|
+
parser->line = parser->line2;
|
|
1453
|
+
|
|
1454
|
+
parser->crlf = parser->crlf2;
|
|
1455
|
+
parser->escaped = parser->escaped2;
|
|
1456
|
+
parser->integer = parser->integer2;
|
|
1457
|
+
parser->modifierLength = parser->modifierLength2;
|
|
1458
|
+
parser->modifier = parser->modifier2;
|
|
1459
|
+
parser->number = parser->number2;
|
|
1460
|
+
parser->rawLength = parser->rawLength2;
|
|
1461
|
+
parser->raw = parser->raw2;
|
|
1462
|
+
parser->stringLength = parser->stringLength2;
|
|
1463
|
+
parser->string = parser->string2;
|
|
1464
|
+
parser->symbol = parser->symbol2;
|
|
1465
|
+
parser->token = parser->token2;
|
|
1466
|
+
|
|
1467
|
+
parser->crlf2 = 0;
|
|
1468
|
+
parser->escaped2 = 0;
|
|
1469
|
+
parser->integer2 = 0;
|
|
1470
|
+
parser->modifierLength2 = 0;
|
|
1471
|
+
parser->modifier2 = parser->emptyString;
|
|
1472
|
+
parser->number2 = 0;
|
|
1473
|
+
parser->rawLength2 = 0;
|
|
1474
|
+
parser->raw2 = parser->emptyString;
|
|
1475
|
+
parser->stringLength2 = 0;
|
|
1476
|
+
parser->string2 = parser->emptyString;
|
|
1477
|
+
parser->symbol2 = C_NULL;
|
|
1478
|
+
parser->token2 = XS_NO_TOKEN;
|
|
1479
|
+
|
|
1480
|
+
while (parser->token2 == XS_NO_TOKEN) {
|
|
1481
|
+
switch (parser->character) {
|
|
1482
|
+
case C_EOF:
|
|
1483
|
+
parser->token2 = XS_TOKEN_EOF;
|
|
1484
|
+
break;
|
|
1485
|
+
case 10:
|
|
1486
|
+
parser->line2++;
|
|
1487
|
+
fxGetNextCharacter(parser);
|
|
1488
|
+
parser->crlf2 = 1;
|
|
1489
|
+
break;
|
|
1490
|
+
case 13:
|
|
1491
|
+
parser->line2++;
|
|
1492
|
+
fxGetNextCharacter(parser);
|
|
1493
|
+
if (parser->character == 10)
|
|
1494
|
+
fxGetNextCharacter(parser);
|
|
1495
|
+
parser->crlf2 = 1;
|
|
1496
|
+
break;
|
|
1497
|
+
|
|
1498
|
+
case '\t':
|
|
1499
|
+
case ' ':
|
|
1500
|
+
fxGetNextCharacter(parser);
|
|
1501
|
+
break;
|
|
1502
|
+
|
|
1503
|
+
case '0':
|
|
1504
|
+
fxGetNextCharacter(parser);
|
|
1505
|
+
c = parser->character;
|
|
1506
|
+
if (c == '.') {
|
|
1507
|
+
fxGetNextCharacter(parser);
|
|
1508
|
+
c = parser->character;
|
|
1509
|
+
if ((('0' <= c) && (c <= '9')) || (c == 'e') || (c == 'E'))
|
|
1510
|
+
fxGetNextNumberE(parser, 1);
|
|
1511
|
+
else {
|
|
1512
|
+
parser->number2 = 0;
|
|
1513
|
+
parser->token2 = XS_TOKEN_NUMBER;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
else if ((c == 'b') || (c == 'B')) {
|
|
1517
|
+
fxGetNextNumberB(parser);
|
|
1518
|
+
}
|
|
1519
|
+
else if ((c == 'e') || (c == 'E')) {
|
|
1520
|
+
fxGetNextNumberE(parser, 0);
|
|
1521
|
+
}
|
|
1522
|
+
else if ((c == 'o') || (c == 'O')) {
|
|
1523
|
+
fxGetNextNumberO(parser, '0', 0);
|
|
1524
|
+
}
|
|
1525
|
+
else if ((c == 'x') || (c == 'X')) {
|
|
1526
|
+
fxGetNextNumberX(parser);
|
|
1527
|
+
}
|
|
1528
|
+
else {
|
|
1529
|
+
parser->integer2 = 0;
|
|
1530
|
+
parser->token2 = XS_TOKEN_INTEGER;
|
|
1531
|
+
}
|
|
1532
|
+
break;
|
|
1533
|
+
case '1':
|
|
1534
|
+
case '2':
|
|
1535
|
+
case '3':
|
|
1536
|
+
case '4':
|
|
1537
|
+
case '5':
|
|
1538
|
+
case '6':
|
|
1539
|
+
case '7':
|
|
1540
|
+
case '8':
|
|
1541
|
+
case '9':
|
|
1542
|
+
case '-':
|
|
1543
|
+
fxGetNextNumberE(parser, 0);
|
|
1544
|
+
break;
|
|
1545
|
+
case ',':
|
|
1546
|
+
parser->token2 = XS_TOKEN_COMMA;
|
|
1547
|
+
fxGetNextCharacter(parser);
|
|
1548
|
+
break;
|
|
1549
|
+
case ':':
|
|
1550
|
+
parser->token2 = XS_TOKEN_COLON;
|
|
1551
|
+
fxGetNextCharacter(parser);
|
|
1552
|
+
break;
|
|
1553
|
+
case '[':
|
|
1554
|
+
parser->token2 = XS_TOKEN_LEFT_BRACKET;
|
|
1555
|
+
fxGetNextCharacter(parser);
|
|
1556
|
+
break;
|
|
1557
|
+
case ']':
|
|
1558
|
+
parser->token2 = XS_TOKEN_RIGHT_BRACKET;
|
|
1559
|
+
fxGetNextCharacter(parser);
|
|
1560
|
+
break;
|
|
1561
|
+
case '{':
|
|
1562
|
+
parser->token2 = XS_TOKEN_LEFT_BRACE;
|
|
1563
|
+
fxGetNextCharacter(parser);
|
|
1564
|
+
break;
|
|
1565
|
+
case '}':
|
|
1566
|
+
parser->token2 = XS_TOKEN_RIGHT_BRACE;
|
|
1567
|
+
fxGetNextCharacter(parser);
|
|
1568
|
+
break;
|
|
1569
|
+
case '"':
|
|
1570
|
+
fxGetNextCharacter(parser);
|
|
1571
|
+
fxGetNextString(parser, '"');
|
|
1572
|
+
parser->token2 = XS_TOKEN_STRING;
|
|
1573
|
+
fxGetNextCharacter(parser);
|
|
1574
|
+
break;
|
|
1575
|
+
default:
|
|
1576
|
+
if (fxIsIdentifierFirst((char)parser->character)) {
|
|
1577
|
+
p = parser->buffer;
|
|
1578
|
+
q = p + parser->bufferSize - 1;
|
|
1579
|
+
for (;;) {
|
|
1580
|
+
if (p == q) {
|
|
1581
|
+
fxReportMemoryError(parser, parser->line, "identifier overflow");
|
|
1582
|
+
}
|
|
1583
|
+
*p++ = (char)parser->character;
|
|
1584
|
+
fxGetNextCharacter(parser);
|
|
1585
|
+
if (!fxIsIdentifierNext((char)parser->character))
|
|
1586
|
+
break;
|
|
1587
|
+
}
|
|
1588
|
+
*p = 0;
|
|
1589
|
+
if (!c_strcmp("false", parser->buffer))
|
|
1590
|
+
parser->token2 = XS_TOKEN_FALSE;
|
|
1591
|
+
else if (!c_strcmp("null", parser->buffer))
|
|
1592
|
+
parser->token2 = XS_TOKEN_NULL;
|
|
1593
|
+
else if (!c_strcmp("true", parser->buffer))
|
|
1594
|
+
parser->token2 = XS_TOKEN_TRUE;
|
|
1595
|
+
else {
|
|
1596
|
+
parser->symbol2 = fxNewParserSymbol(parser, parser->buffer);
|
|
1597
|
+
parser->token2 = XS_TOKEN_IDENTIFIER;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
else {
|
|
1601
|
+
fxReportParserError(parser, parser->line, "invalid character %d", parser->character);
|
|
1602
|
+
fxGetNextCharacter(parser);
|
|
1603
|
+
}
|
|
1604
|
+
break;
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
typedef struct {
|
|
1610
|
+
char* name;
|
|
1611
|
+
int value;
|
|
1612
|
+
} txEntity;
|
|
1613
|
+
|
|
1614
|
+
static int fxCompareEntities(const void *name, const void *entity);
|
|
1615
|
+
|
|
1616
|
+
#define XS_ENTITIES_COUNT 253
|
|
1617
|
+
static const txEntity ICACHE_RODATA_ATTR gxEntities[XS_ENTITIES_COUNT] = {
|
|
1618
|
+
{ "AElig", 0x00C6 }, { "Aacute", 0x00C1 }, { "Acirc", 0x00C2 }, { "Agrave", 0x00C0 }, { "Alpha", 0x0391 }, { "Aring", 0x00C5 }, { "Atilde", 0x00C3 }, { "Auml", 0x00C4 },
|
|
1619
|
+
{ "Beta", 0x0392 }, { "Ccedil", 0x00C7 }, { "Chi", 0x03A7 }, { "Dagger", 0x2021 }, { "Delta", 0x0394 }, { "ETH", 0x00D0 }, { "Eacute", 0x00C9 }, { "Ecirc", 0x00CA },
|
|
1620
|
+
{ "Egrave", 0x00C8 }, { "Epsilon", 0x0395 }, { "Eta", 0x0397 }, { "Euml", 0x00CB }, { "Gamma", 0x0393 }, { "Iacute", 0x00CD }, { "Icirc", 0x00CE }, { "Igrave", 0x00CC },
|
|
1621
|
+
{ "Iota", 0x0399 }, { "Iuml", 0x00CF }, { "Kappa", 0x039A }, { "Lambda", 0x039B }, { "Mu", 0x039C }, { "Ntilde", 0x00D1 }, { "Nu", 0x039D }, { "OElig", 0x0152 },
|
|
1622
|
+
{ "Oacute", 0x00D3 }, { "Ocirc", 0x00D4 }, { "Ograve", 0x00D2 }, { "Omega", 0x03A9 }, { "Omicron", 0x039F }, { "Oslash", 0x00D8 }, { "Otilde", 0x00D5 }, { "Ouml", 0x00D6 },
|
|
1623
|
+
{ "Phi", 0x03A6 }, { "Pi", 0x03A0 }, { "Prime", 0x2033 }, { "Psi", 0x03A8 }, { "Rho", 0x03A1 }, { "Scaron", 0x0160 }, { "Sigma", 0x03A3 }, { "THORN", 0x00DE },
|
|
1624
|
+
{ "Tau", 0x03A4 }, { "Theta", 0x0398 }, { "Uacute", 0x00DA }, { "Ucirc", 0x00DB }, { "Ugrave", 0x00D9 }, { "Upsilon", 0x03A5 }, { "Uuml", 0x00DC }, { "Xi", 0x039E },
|
|
1625
|
+
{ "Yacute", 0x00DD }, { "Yuml", 0x0178 }, { "Zeta", 0x0396 }, { "aacute", 0x00E1 }, { "acirc", 0x00E2 }, { "acute", 0x00B4 }, { "aelig", 0x00E6 }, { "agrave", 0x00E0 },
|
|
1626
|
+
{ "alefsym", 0x2135 }, { "alpha", 0x03B1 }, { "amp", 0x0026 }, { "and", 0x2227 }, { "ang", 0x2220 }, { "apos", 0x0027 }, { "aring", 0x00E5 }, { "asymp", 0x2248 },
|
|
1627
|
+
{ "atilde", 0x00E3 }, { "auml", 0x00E4 }, { "bdquo", 0x201E }, { "beta", 0x03B2 }, { "brvbar", 0x00A6 }, { "bull", 0x2022 }, { "cap", 0x2229 }, { "ccedil", 0x00E7 },
|
|
1628
|
+
{ "cedil", 0x00B8 }, { "cent", 0x00A2 }, { "chi", 0x03C7 }, { "circ", 0x02C6 }, { "clubs", 0x2663 }, { "cong", 0x2245 }, { "copy", 0x00A9 }, { "crarr", 0x21B5 },
|
|
1629
|
+
{ "cup", 0x222A }, { "curren", 0x00A4 }, { "dArr", 0x21D3 }, { "dagger", 0x2020 }, { "darr", 0x2193 }, { "deg", 0x00B0 }, { "delta", 0x03B4 }, { "diams", 0x2666 },
|
|
1630
|
+
{ "divide", 0x00F7 }, { "eacute", 0x00E9 }, { "ecirc", 0x00EA }, { "egrave", 0x00E8 }, { "empty", 0x2205 }, { "emsp", 0x2003 }, { "ensp", 0x2002 }, { "epsilon", 0x03B5 },
|
|
1631
|
+
{ "equiv", 0x2261 }, { "eta", 0x03B7 }, { "eth", 0x00F0 }, { "euml", 0x00EB }, { "euro", 0x20AC }, { "exist", 0x2203 }, { "fnof", 0x0192 }, { "forall", 0x2200 },
|
|
1632
|
+
{ "frac12", 0x00BD }, { "frac14", 0x00BC }, { "frac34", 0x00BE }, { "frasl", 0x2044 }, { "gamma", 0x03B3 }, { "ge", 0x2265 }, { "gt", 0x003E }, { "hArr", 0x21D4 },
|
|
1633
|
+
{ "harr", 0x2194 }, { "hearts", 0x2665 }, { "hellip", 0x2026 }, { "iacute", 0x00ED }, { "icirc", 0x00EE }, { "iexcl", 0x00A1 }, { "igrave", 0x00EC }, { "image", 0x2111 },
|
|
1634
|
+
{ "infin", 0x221E }, { "int", 0x222B }, { "iota", 0x03B9 }, { "iquest", 0x00BF }, { "isin", 0x2208 }, { "iuml", 0x00EF }, { "kappa", 0x03BA }, { "lArr", 0x21D0 },
|
|
1635
|
+
{ "lambda", 0x03BB }, { "lang", 0x2329 }, { "laquo", 0x00AB }, { "larr", 0x2190 }, { "lceil", 0x2308 }, { "ldquo", 0x201C }, { "le", 0x2264 }, { "lfloor", 0x230A },
|
|
1636
|
+
{ "lowast", 0x2217 }, { "loz", 0x25CA }, { "lrm", 0x200E }, { "lsaquo", 0x2039 }, { "lsquo", 0x2018 }, { "lt", 0x003C }, { "macr", 0x00AF }, { "mdash", 0x2014 },
|
|
1637
|
+
{ "micro", 0x00B5 }, { "middot", 0x00B7 }, { "minus", 0x2212 }, { "mu", 0x03BC }, { "nabla", 0x2207 }, { "nbsp", 0x00A0 }, { "ndash", 0x2013 }, { "ne", 0x2260 },
|
|
1638
|
+
{ "ni", 0x220B }, { "not", 0x00AC }, { "notin", 0x2209 }, { "nsub", 0x2284 }, { "ntilde", 0x00F1 }, { "nu", 0x03BD }, { "oacute", 0x00F3 }, { "ocirc", 0x00F4 },
|
|
1639
|
+
{ "oelig", 0x0153 }, { "ograve", 0x00F2 }, { "oline", 0x203E }, { "omega", 0x03C9 }, { "omicron", 0x03BF }, { "oplus", 0x2295 }, { "or", 0x2228 }, { "ordf", 0x00AA },
|
|
1640
|
+
{ "ordm", 0x00BA }, { "oslash", 0x00F8 }, { "otilde", 0x00F5 }, { "otimes", 0x2297 }, { "ouml", 0x00F6 }, { "para", 0x00B6 }, { "part", 0x2202 }, { "permil", 0x2030 },
|
|
1641
|
+
{ "perp", 0x22A5 }, { "phi", 0x03C6 }, { "pi", 0x03C0 }, { "piv", 0x03D6 }, { "plusmn", 0x00B1 }, { "pound", 0x00A3 }, { "prime", 0x2032 }, { "prod", 0x220F },
|
|
1642
|
+
{ "prop", 0x221D }, { "psi", 0x03C8 }, { "quot", 0x0022 }, { "rArr", 0x21D2 }, { "radic", 0x221A }, { "rang", 0x232A }, { "raquo", 0x00BB }, { "rarr", 0x2192 },
|
|
1643
|
+
{ "rceil", 0x2309 }, { "rdquo", 0x201D }, { "real", 0x211C }, { "reg", 0x00AE }, { "rfloor", 0x230B }, { "rho", 0x03C1 }, { "rlm", 0x200F }, { "rsaquo", 0x203A },
|
|
1644
|
+
{ "rsquo", 0x2019 }, { "sbquo", 0x201A }, { "scaron", 0x0161 }, { "sdot", 0x22C5 }, { "sect", 0x00A7 }, { "shy", 0x00AD }, { "sigma", 0x03C3 }, { "sigmaf", 0x03C2 },
|
|
1645
|
+
{ "sim", 0x223C }, { "spades", 0x2660 }, { "sub", 0x2282 }, { "sube", 0x2286 }, { "sum", 0x2211 }, { "sup", 0x2283 }, { "sup1", 0x00B9 }, { "sup2", 0x00B2 },
|
|
1646
|
+
{ "sup3", 0x00B3 }, { "supe", 0x2287 }, { "szlig", 0x00DF }, { "tau", 0x03C4 }, { "there4", 0x2234 }, { "theta", 0x03B8 }, { "thetasym", 0x03D1 }, { "thinsp", 0x2009 },
|
|
1647
|
+
{ "thorn", 0x00FE }, { "tilde", 0x02DC }, { "times", 0x00D7 }, { "trade", 0x2122 }, { "uArr", 0x21D1 }, { "uacute", 0x00FA }, { "uarr", 0x2191 }, { "ucirc", 0x00FB },
|
|
1648
|
+
{ "ugrave", 0x00F9 }, { "uml", 0x00A8 }, { "upsih", 0x03D2 }, { "upsilon", 0x03C5 }, { "uuml", 0x00FC }, { "weierp", 0x2118 }, { "xi", 0x03BE }, { "yacute", 0x00FD },
|
|
1649
|
+
{ "yen", 0x00A5 }, { "yuml", 0x00FF }, { "zeta", 0x03B6 }, { "zwj", 0x200D }, { "zwnj", 0x200C },
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1652
|
+
int fxCompareEntities(const void *name, const void *entity)
|
|
1653
|
+
{
|
|
1654
|
+
return c_strcmp((char*)name, ((txEntity*)entity)->name);
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
txString fxGetNextEntity(txParser* parser, txString p, txString q)
|
|
1658
|
+
{
|
|
1659
|
+
txString r = p;
|
|
1660
|
+
txU4 t = 0;
|
|
1661
|
+
if (p < q) *p++ = '&';
|
|
1662
|
+
fxGetNextCharacter(parser);
|
|
1663
|
+
if (parser->character == '#') {
|
|
1664
|
+
if (p < q) *p++ = '#';
|
|
1665
|
+
fxGetNextCharacter(parser);
|
|
1666
|
+
if (parser->character == 'x') {
|
|
1667
|
+
if (p < q) *p++ = 'x';
|
|
1668
|
+
fxGetNextCharacter(parser);
|
|
1669
|
+
while (fxGetNextStringX(parser->character, &t)) {
|
|
1670
|
+
if (p < q) *p++ = parser->character;
|
|
1671
|
+
fxGetNextCharacter(parser);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
else {
|
|
1675
|
+
while (fxGetNextStringD(parser->character, &t)) {
|
|
1676
|
+
if (p < q) *p++ = parser->character;
|
|
1677
|
+
fxGetNextCharacter(parser);
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
else {
|
|
1682
|
+
txEntity* entity = C_NULL;
|
|
1683
|
+
int c = parser->character;
|
|
1684
|
+
while ((p < q) && ((('0' <= c) && (c <= '9')) || (('A' <= c) && (c <= 'Z')) || (('a' <= c) && (c <= 'z')))) {
|
|
1685
|
+
if (p < q) *p++ = c;
|
|
1686
|
+
fxGetNextCharacter(parser);
|
|
1687
|
+
c = parser->character;
|
|
1688
|
+
}
|
|
1689
|
+
*p = 0;
|
|
1690
|
+
if (r < q)
|
|
1691
|
+
entity = (txEntity*)bsearch(r + 1, gxEntities, XS_ENTITIES_COUNT, sizeof(txEntity), fxCompareEntities);
|
|
1692
|
+
t = entity ? entity->value : 0;
|
|
1693
|
+
}
|
|
1694
|
+
if (parser->character == ';') {
|
|
1695
|
+
if (p < q) *p++ = ';';
|
|
1696
|
+
fxGetNextCharacter(parser);
|
|
1697
|
+
if (t)
|
|
1698
|
+
p = fxUTF8Buffer(parser, t, r, q);
|
|
1699
|
+
}
|
|
1700
|
+
return p;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
void fxGetNextTokenJSXAttribute(txParser* parser)
|
|
1704
|
+
{
|
|
1705
|
+
txString p = parser->buffer;
|
|
1706
|
+
txString q = p + parser->bufferSize - 1;
|
|
1707
|
+
txU4 quote = 0;
|
|
1708
|
+
parser->crlf2 = 0;
|
|
1709
|
+
parser->escaped2 = 0;
|
|
1710
|
+
parser->integer2 = 0;
|
|
1711
|
+
parser->modifierLength2 = 0;
|
|
1712
|
+
parser->modifier2 = parser->emptyString;
|
|
1713
|
+
parser->number2 = 0;
|
|
1714
|
+
parser->rawLength2 = 0;
|
|
1715
|
+
parser->raw2 = parser->emptyString;
|
|
1716
|
+
parser->stringLength2 = 0;
|
|
1717
|
+
parser->string2 = parser->emptyString;
|
|
1718
|
+
parser->symbol2 = C_NULL;
|
|
1719
|
+
parser->token2 = XS_NO_TOKEN;
|
|
1720
|
+
while (parser->token2 == XS_NO_TOKEN) {
|
|
1721
|
+
switch (parser->character) {
|
|
1722
|
+
case C_EOF:
|
|
1723
|
+
parser->token2 = XS_TOKEN_EOF;
|
|
1724
|
+
break;
|
|
1725
|
+
case 10:
|
|
1726
|
+
case 0x2028: // <LS>
|
|
1727
|
+
case 0x2029: // <PS>
|
|
1728
|
+
parser->line2++;
|
|
1729
|
+
if (quote)
|
|
1730
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1731
|
+
fxGetNextCharacter(parser);
|
|
1732
|
+
parser->crlf2 = 1;
|
|
1733
|
+
break;
|
|
1734
|
+
case 13:
|
|
1735
|
+
parser->line2++;
|
|
1736
|
+
if (quote)
|
|
1737
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1738
|
+
fxGetNextCharacter(parser);
|
|
1739
|
+
if (parser->character == 10) {
|
|
1740
|
+
if (quote)
|
|
1741
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1742
|
+
fxGetNextCharacter(parser);
|
|
1743
|
+
}
|
|
1744
|
+
parser->crlf2 = 1;
|
|
1745
|
+
break;
|
|
1746
|
+
case '\t':
|
|
1747
|
+
case 11:
|
|
1748
|
+
case 12:
|
|
1749
|
+
case ' ':
|
|
1750
|
+
case 0x00A0:
|
|
1751
|
+
case 0x1680:
|
|
1752
|
+
case 0x2000:
|
|
1753
|
+
case 0x2001:
|
|
1754
|
+
case 0x2002:
|
|
1755
|
+
case 0x2003:
|
|
1756
|
+
case 0x2004:
|
|
1757
|
+
case 0x2005:
|
|
1758
|
+
case 0x2006:
|
|
1759
|
+
case 0x2007:
|
|
1760
|
+
case 0x2008:
|
|
1761
|
+
case 0x2009:
|
|
1762
|
+
case 0x200A:
|
|
1763
|
+
case 0x202F:
|
|
1764
|
+
case 0x205F:
|
|
1765
|
+
case 0x3000:
|
|
1766
|
+
case 0xFEFF:
|
|
1767
|
+
if (quote)
|
|
1768
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1769
|
+
fxGetNextCharacter(parser);
|
|
1770
|
+
break;
|
|
1771
|
+
|
|
1772
|
+
case '{':
|
|
1773
|
+
if (quote)
|
|
1774
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1775
|
+
else
|
|
1776
|
+
parser->token2 = XS_TOKEN_LEFT_BRACE;
|
|
1777
|
+
fxGetNextCharacter(parser);
|
|
1778
|
+
break;
|
|
1779
|
+
|
|
1780
|
+
case '"':
|
|
1781
|
+
case '\'':
|
|
1782
|
+
if (quote) {
|
|
1783
|
+
if (quote == parser->character) {
|
|
1784
|
+
parser->stringLength2 = mxPtrDiff(p - parser->buffer);
|
|
1785
|
+
parser->string2 = fxNewParserString(parser, parser->buffer, parser->stringLength2);
|
|
1786
|
+
parser->token2 = XS_TOKEN_STRING;
|
|
1787
|
+
}
|
|
1788
|
+
else
|
|
1789
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1790
|
+
}
|
|
1791
|
+
else
|
|
1792
|
+
quote = parser->character;
|
|
1793
|
+
fxGetNextCharacter(parser);
|
|
1794
|
+
break;
|
|
1795
|
+
|
|
1796
|
+
case '&':
|
|
1797
|
+
if (quote)
|
|
1798
|
+
p = fxGetNextEntity(parser, p, q);
|
|
1799
|
+
else {
|
|
1800
|
+
fxReportParserError(parser, parser->line, "invalid character %d", parser->character);
|
|
1801
|
+
fxGetNextCharacter(parser);
|
|
1802
|
+
}
|
|
1803
|
+
break;
|
|
1804
|
+
|
|
1805
|
+
default:
|
|
1806
|
+
if (quote)
|
|
1807
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1808
|
+
else
|
|
1809
|
+
fxReportParserError(parser, parser->line, "invalid character %d", parser->character);
|
|
1810
|
+
fxGetNextCharacter(parser);
|
|
1811
|
+
break;
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
parser->line = parser->line2;
|
|
1815
|
+
parser->crlf = parser->crlf2;
|
|
1816
|
+
parser->escaped = parser->escaped2;
|
|
1817
|
+
parser->integer = parser->integer2;
|
|
1818
|
+
parser->modifierLength = parser->modifierLength2;
|
|
1819
|
+
parser->modifier = parser->modifier2;
|
|
1820
|
+
parser->number = parser->number2;
|
|
1821
|
+
parser->rawLength = parser->rawLength2;
|
|
1822
|
+
parser->raw = parser->raw2;
|
|
1823
|
+
parser->stringLength = parser->stringLength2;
|
|
1824
|
+
parser->string = parser->string2;
|
|
1825
|
+
parser->symbol = parser->symbol2;
|
|
1826
|
+
parser->token = parser->token2;
|
|
1827
|
+
parser->ahead = 0;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
void fxGetNextTokenJSXChild(txParser* parser)
|
|
1831
|
+
{
|
|
1832
|
+
txString p = parser->buffer;
|
|
1833
|
+
txString q = p + parser->bufferSize - 1;
|
|
1834
|
+
txString s = C_NULL;
|
|
1835
|
+
char c;
|
|
1836
|
+
txString after = C_NULL;
|
|
1837
|
+
txString before = C_NULL;
|
|
1838
|
+
txString text = C_NULL;
|
|
1839
|
+
parser->crlf2 = 0;
|
|
1840
|
+
parser->escaped2 = 0;
|
|
1841
|
+
parser->integer2 = 0;
|
|
1842
|
+
parser->modifierLength2 = 0;
|
|
1843
|
+
parser->modifier2 = parser->emptyString;
|
|
1844
|
+
parser->number2 = 0;
|
|
1845
|
+
parser->rawLength2 = 0;
|
|
1846
|
+
parser->raw2 = parser->emptyString;
|
|
1847
|
+
parser->stringLength2 = 0;
|
|
1848
|
+
parser->string2 = parser->emptyString;
|
|
1849
|
+
parser->symbol2 = C_NULL;
|
|
1850
|
+
parser->token2 = XS_NO_TOKEN;
|
|
1851
|
+
while (parser->token2 == XS_NO_TOKEN) {
|
|
1852
|
+
switch (parser->character) {
|
|
1853
|
+
case C_EOF:
|
|
1854
|
+
parser->token2 = XS_TOKEN_EOF;
|
|
1855
|
+
break;
|
|
1856
|
+
case 10:
|
|
1857
|
+
case 0x2028: // <LS>
|
|
1858
|
+
case 0x2029: // <PS>
|
|
1859
|
+
parser->line2++;
|
|
1860
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1861
|
+
fxGetNextCharacter(parser);
|
|
1862
|
+
parser->crlf2 = 1;
|
|
1863
|
+
break;
|
|
1864
|
+
case 13:
|
|
1865
|
+
parser->line2++;
|
|
1866
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1867
|
+
fxGetNextCharacter(parser);
|
|
1868
|
+
if (parser->character == 10) {
|
|
1869
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1870
|
+
fxGetNextCharacter(parser);
|
|
1871
|
+
}
|
|
1872
|
+
parser->crlf2 = 1;
|
|
1873
|
+
break;
|
|
1874
|
+
|
|
1875
|
+
case '<':
|
|
1876
|
+
fxGetNextCharacter(parser);
|
|
1877
|
+
parser->token2 = XS_TOKEN_LESS;
|
|
1878
|
+
break;
|
|
1879
|
+
case '>':
|
|
1880
|
+
fxGetNextCharacter(parser);
|
|
1881
|
+
parser->token2 = XS_TOKEN_MORE;
|
|
1882
|
+
break;
|
|
1883
|
+
case '{':
|
|
1884
|
+
fxGetNextCharacter(parser);
|
|
1885
|
+
parser->token2 = XS_TOKEN_LEFT_BRACE;
|
|
1886
|
+
break;
|
|
1887
|
+
case '}':
|
|
1888
|
+
fxGetNextCharacter(parser);
|
|
1889
|
+
parser->token2 = XS_TOKEN_RIGHT_BRACE;
|
|
1890
|
+
break;
|
|
1891
|
+
case '&':
|
|
1892
|
+
p = fxGetNextEntity(parser, p, q);
|
|
1893
|
+
break;
|
|
1894
|
+
default:
|
|
1895
|
+
p = fxUTF8Buffer(parser, parser->character, p, q);
|
|
1896
|
+
fxGetNextCharacter(parser);
|
|
1897
|
+
break;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
parser->rawLength2 = mxPtrDiff(p - parser->buffer);
|
|
1901
|
+
parser->raw2 = fxNewParserString(parser, parser->buffer, parser->rawLength2);
|
|
1902
|
+
if (parser->crlf2) {
|
|
1903
|
+
p = parser->buffer;
|
|
1904
|
+
q = p + parser->bufferSize - 1;
|
|
1905
|
+
s = parser->raw2;
|
|
1906
|
+
c = *s++;
|
|
1907
|
+
while (c) {
|
|
1908
|
+
if ((c == 10) || (c == 13)) {
|
|
1909
|
+
if (before)
|
|
1910
|
+
p = before;
|
|
1911
|
+
else
|
|
1912
|
+
before = p;
|
|
1913
|
+
after = p;
|
|
1914
|
+
}
|
|
1915
|
+
else if ((c == 9) || (c == 32)) {
|
|
1916
|
+
if (!before)
|
|
1917
|
+
before = p;
|
|
1918
|
+
*p++ = c;
|
|
1919
|
+
}
|
|
1920
|
+
else {
|
|
1921
|
+
if (after) {
|
|
1922
|
+
p = after;
|
|
1923
|
+
if (text)
|
|
1924
|
+
*p++ = 32;
|
|
1925
|
+
}
|
|
1926
|
+
after = C_NULL;
|
|
1927
|
+
before = C_NULL;
|
|
1928
|
+
text = p;
|
|
1929
|
+
*p++ = c;
|
|
1930
|
+
}
|
|
1931
|
+
c = *s++;
|
|
1932
|
+
}
|
|
1933
|
+
if (after)
|
|
1934
|
+
p = after;
|
|
1935
|
+
}
|
|
1936
|
+
parser->stringLength2 = mxPtrDiff(p - parser->buffer);
|
|
1937
|
+
parser->string2 = fxNewParserString(parser, parser->buffer, parser->stringLength2);
|
|
1938
|
+
|
|
1939
|
+
parser->line = parser->line2;
|
|
1940
|
+
parser->crlf = parser->crlf2;
|
|
1941
|
+
parser->escaped = parser->escaped2;
|
|
1942
|
+
parser->integer = parser->integer2;
|
|
1943
|
+
parser->modifierLength = parser->modifierLength2;
|
|
1944
|
+
parser->modifier = parser->modifier2;
|
|
1945
|
+
parser->number = parser->number2;
|
|
1946
|
+
parser->rawLength = parser->rawLength2;
|
|
1947
|
+
parser->raw = parser->raw2;
|
|
1948
|
+
parser->stringLength = parser->stringLength2;
|
|
1949
|
+
parser->string = parser->string2;
|
|
1950
|
+
parser->symbol = parser->symbol2;
|
|
1951
|
+
parser->token = parser->token2;
|
|
1952
|
+
parser->ahead = 0;
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
|
|
1956
|
+
|
|
1957
|
+
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
|
|
1962
|
+
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
|