@agoric/xsnap 0.14.3-u13.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 +39 -22
- 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 -646
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-2022 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
|
+
void fxCheckParserStack(txParser* parser, txInteger line)
|
|
41
|
+
{
|
|
42
|
+
char x;
|
|
43
|
+
char *stack = &x;
|
|
44
|
+
if (stack <= parser->stackLimit) {
|
|
45
|
+
fxReportMemoryError(parser, line, "stack overflow");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
txString fxCombinePath(txParser* parser, txString base, txString name)
|
|
50
|
+
{
|
|
51
|
+
txSize baseLength, nameLength;
|
|
52
|
+
txString path;
|
|
53
|
+
txString separator ;
|
|
54
|
+
#if mxWindows
|
|
55
|
+
separator = name;
|
|
56
|
+
while (*separator) {
|
|
57
|
+
if (*separator == '/')
|
|
58
|
+
*separator = '\\';
|
|
59
|
+
separator++;
|
|
60
|
+
}
|
|
61
|
+
separator = strrchr(base, '\\');
|
|
62
|
+
#else
|
|
63
|
+
separator = strrchr(base, '/');
|
|
64
|
+
#endif
|
|
65
|
+
if (separator) {
|
|
66
|
+
separator++;
|
|
67
|
+
baseLength = mxPtrDiff(separator - base);
|
|
68
|
+
}
|
|
69
|
+
else
|
|
70
|
+
baseLength = 0;
|
|
71
|
+
nameLength = mxStringLength(name);
|
|
72
|
+
path = fxNewParserChunk(parser, baseLength + nameLength + 1);
|
|
73
|
+
if (baseLength)
|
|
74
|
+
c_memcpy(path, base, baseLength);
|
|
75
|
+
c_memcpy(path + baseLength, name, nameLength + 1);
|
|
76
|
+
return path;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
void fxDisposeParserChunks(txParser* parser)
|
|
80
|
+
{
|
|
81
|
+
txParserChunk** address = &parser->first;
|
|
82
|
+
txParserChunk* block;
|
|
83
|
+
while ((block = *address)) {
|
|
84
|
+
*address = block->next;
|
|
85
|
+
c_free(block);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
void fxInitializeParser(txParser* parser, void* console, txSize bufferSize, txSize symbolModulo)
|
|
90
|
+
{
|
|
91
|
+
c_memset(parser, 0, sizeof(txParser));
|
|
92
|
+
parser->first = C_NULL;
|
|
93
|
+
parser->console = console;
|
|
94
|
+
parser->stackLimit = fxCStackLimit();
|
|
95
|
+
|
|
96
|
+
parser->dtoa = fxNew_dtoa(NULL);
|
|
97
|
+
parser->symbolModulo = symbolModulo;
|
|
98
|
+
parser->symbolTable = fxNewParserChunkClear(parser, parser->symbolModulo * sizeof(txSymbol*));
|
|
99
|
+
|
|
100
|
+
parser->emptyString = fxNewParserString(parser, "", 0);
|
|
101
|
+
|
|
102
|
+
parser->ObjectSymbol = fxNewParserSymbol(parser, "Object");
|
|
103
|
+
parser->__dirnameSymbol = fxNewParserSymbol(parser, "__dirname");
|
|
104
|
+
parser->__filenameSymbol = fxNewParserSymbol(parser, "__filename");
|
|
105
|
+
parser->__jsx__Symbol = fxNewParserSymbol(parser, "__jsx__");
|
|
106
|
+
parser->__proto__Symbol = fxNewParserSymbol(parser, "__proto__");
|
|
107
|
+
parser->allSymbol = fxNewParserSymbol(parser, "*");
|
|
108
|
+
parser->argsSymbol = fxNewParserSymbol(parser, "args");
|
|
109
|
+
parser->argumentsSymbol = fxNewParserSymbol(parser, "arguments");
|
|
110
|
+
parser->arrowSymbol = fxNewParserSymbol(parser, "=>");
|
|
111
|
+
parser->asSymbol = fxNewParserSymbol(parser, "as");
|
|
112
|
+
parser->asyncSymbol = fxNewParserSymbol(parser, "async");
|
|
113
|
+
parser->awaitSymbol = fxNewParserSymbol(parser, "await");
|
|
114
|
+
parser->callerSymbol = fxNewParserSymbol(parser, "caller");
|
|
115
|
+
parser->constructorSymbol = fxNewParserSymbol(parser, "constructor");
|
|
116
|
+
parser->defaultSymbol = fxNewParserSymbol(parser, "default");
|
|
117
|
+
parser->doneSymbol = fxNewParserSymbol(parser, "done");
|
|
118
|
+
parser->evalSymbol = fxNewParserSymbol(parser, "eval");
|
|
119
|
+
parser->exportsSymbol = fxNewParserSymbol(parser, "exports");
|
|
120
|
+
parser->fillSymbol = fxNewParserSymbol(parser, "fill");
|
|
121
|
+
parser->freezeSymbol = fxNewParserSymbol(parser, "freeze");
|
|
122
|
+
parser->fromSymbol = fxNewParserSymbol(parser, "from");
|
|
123
|
+
parser->getSymbol = fxNewParserSymbol(parser, "get");
|
|
124
|
+
parser->idSymbol = fxNewParserSymbol(parser, "id");
|
|
125
|
+
parser->includeSymbol = fxNewParserSymbol(parser, "include");
|
|
126
|
+
parser->InfinitySymbol = fxNewParserSymbol(parser, "Infinity");
|
|
127
|
+
parser->lengthSymbol = fxNewParserSymbol(parser, "length");
|
|
128
|
+
parser->letSymbol = fxNewParserSymbol(parser, "let");
|
|
129
|
+
parser->metaSymbol = fxNewParserSymbol(parser, "meta");
|
|
130
|
+
parser->moduleSymbol = fxNewParserSymbol(parser, "module");
|
|
131
|
+
parser->nameSymbol = fxNewParserSymbol(parser, "name");
|
|
132
|
+
parser->NaNSymbol = fxNewParserSymbol(parser, "NaN");
|
|
133
|
+
parser->nextSymbol = fxNewParserSymbol(parser, "next");
|
|
134
|
+
parser->newTargetSymbol = fxNewParserSymbol(parser, "new.target");
|
|
135
|
+
parser->ofSymbol = fxNewParserSymbol(parser, "of");
|
|
136
|
+
parser->privateConstructorSymbol = fxNewParserSymbol(parser, "#constructor");
|
|
137
|
+
parser->prototypeSymbol = fxNewParserSymbol(parser, "prototype");
|
|
138
|
+
parser->RangeErrorSymbol = fxNewParserSymbol(parser, "RangeError");
|
|
139
|
+
parser->rawSymbol = fxNewParserSymbol(parser, "raw");
|
|
140
|
+
parser->returnSymbol = fxNewParserSymbol(parser, "return");
|
|
141
|
+
parser->setSymbol = fxNewParserSymbol(parser, "set");
|
|
142
|
+
parser->sliceSymbol = fxNewParserSymbol(parser, "slice");
|
|
143
|
+
parser->SyntaxErrorSymbol = fxNewParserSymbol(parser, "SyntaxError");
|
|
144
|
+
parser->staticSymbol = fxNewParserSymbol(parser, "static");
|
|
145
|
+
parser->StringSymbol = fxNewParserSymbol(parser, "String");
|
|
146
|
+
parser->targetSymbol = fxNewParserSymbol(parser, "target");
|
|
147
|
+
parser->thisSymbol = fxNewParserSymbol(parser, "this");
|
|
148
|
+
parser->throwSymbol = fxNewParserSymbol(parser, "throw");
|
|
149
|
+
parser->toStringSymbol = fxNewParserSymbol(parser, "toString");
|
|
150
|
+
parser->undefinedSymbol = fxNewParserSymbol(parser, "undefined");
|
|
151
|
+
parser->uriSymbol = fxNewParserSymbol(parser, "uri");
|
|
152
|
+
parser->valueSymbol = fxNewParserSymbol(parser, "value");
|
|
153
|
+
parser->withSymbol = fxNewParserSymbol(parser, "with");
|
|
154
|
+
parser->yieldSymbol = fxNewParserSymbol(parser, "yield");
|
|
155
|
+
|
|
156
|
+
parser->errorSymbol = NULL;
|
|
157
|
+
parser->reportError = fxVReportError;
|
|
158
|
+
parser->reportWarning = fxVReportWarning;
|
|
159
|
+
|
|
160
|
+
parser->buffer = fxNewParserChunk(parser, bufferSize);
|
|
161
|
+
parser->bufferSize = bufferSize;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
void* fxNewParserChunk(txParser* parser, txSize size)
|
|
165
|
+
{
|
|
166
|
+
txParserChunk* block = c_malloc(sizeof(txParserChunk) + size);
|
|
167
|
+
if (!block)
|
|
168
|
+
fxReportMemoryError(parser, parser->line, "heap overflow");
|
|
169
|
+
parser->total += sizeof(txParserChunk) + size;
|
|
170
|
+
block->next = parser->first;
|
|
171
|
+
parser->first = block;
|
|
172
|
+
return block + 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
void* fxNewParserChunkClear(txParser* parser, txSize size)
|
|
176
|
+
{
|
|
177
|
+
void* result = fxNewParserChunk(parser, size);
|
|
178
|
+
c_memset(result, 0, size);
|
|
179
|
+
return result;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
txString fxNewParserString(txParser* parser, txString buffer, txSize size)
|
|
183
|
+
{
|
|
184
|
+
if (parser->buffer) {
|
|
185
|
+
txString result = fxNewParserChunk(parser, size + 1);
|
|
186
|
+
c_memcpy(result, buffer, size);
|
|
187
|
+
result[size] = 0;
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
return buffer;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
txSymbol* fxNewParserSymbol(txParser* parser, txString theString)
|
|
194
|
+
{
|
|
195
|
+
txString aString;
|
|
196
|
+
txSize aLength;
|
|
197
|
+
txU4 aSum;
|
|
198
|
+
txU4 aModulo;
|
|
199
|
+
txSymbol* aSymbol;
|
|
200
|
+
|
|
201
|
+
aString = theString;
|
|
202
|
+
aLength = 0;
|
|
203
|
+
aSum = 0;
|
|
204
|
+
while(*aString != 0) {
|
|
205
|
+
aLength++;
|
|
206
|
+
aSum = (aSum << 1) + *aString++;
|
|
207
|
+
}
|
|
208
|
+
aSum &= 0x7FFFFFFF;
|
|
209
|
+
aModulo = aSum % parser->symbolModulo;
|
|
210
|
+
aSymbol = parser->symbolTable[aModulo];
|
|
211
|
+
while (aSymbol != C_NULL) {
|
|
212
|
+
if (aSymbol->sum == aSum)
|
|
213
|
+
if (c_strcmp(aSymbol->string, theString) == 0)
|
|
214
|
+
break;
|
|
215
|
+
aSymbol = aSymbol->next;
|
|
216
|
+
}
|
|
217
|
+
if (aSymbol == C_NULL) {
|
|
218
|
+
aSymbol = fxNewParserChunk(parser, sizeof(txSymbol));
|
|
219
|
+
aSymbol->next = parser->symbolTable[aModulo];
|
|
220
|
+
aSymbol->ID = -1;
|
|
221
|
+
aSymbol->length = aLength + 1;
|
|
222
|
+
aSymbol->string = fxNewParserString(parser, theString, aLength);
|
|
223
|
+
aSymbol->sum = aSum;
|
|
224
|
+
aSymbol->usage = 0;
|
|
225
|
+
parser->symbolTable[aModulo] = aSymbol;
|
|
226
|
+
}
|
|
227
|
+
return aSymbol;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
void fxReportMemoryError(txParser* parser, txInteger line, txString theFormat, ...)
|
|
231
|
+
{
|
|
232
|
+
c_va_list arguments;
|
|
233
|
+
parser->error = C_ENOMEM;
|
|
234
|
+
parser->errorCount++;
|
|
235
|
+
c_va_start(arguments, theFormat);
|
|
236
|
+
(*parser->reportError)(parser->console, parser->path ? parser->path->string : C_NULL, line, theFormat, arguments);
|
|
237
|
+
c_va_end(arguments);
|
|
238
|
+
if (parser->console) {
|
|
239
|
+
parser->errorSymbol = parser->RangeErrorSymbol;
|
|
240
|
+
if (parser->buffer != theFormat) {
|
|
241
|
+
c_va_start(arguments, theFormat);
|
|
242
|
+
c_vsnprintf(parser->buffer, parser->bufferSize, theFormat, arguments);
|
|
243
|
+
c_va_end(arguments);
|
|
244
|
+
}
|
|
245
|
+
parser->errorMessage = fxNewParserString(parser, parser->buffer, mxStringLength(parser->buffer));
|
|
246
|
+
}
|
|
247
|
+
c_longjmp(parser->firstJump->jmp_buf, 1);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
void fxReportParserError(txParser* parser, txInteger line, txString theFormat, ...)
|
|
251
|
+
{
|
|
252
|
+
c_va_list arguments;
|
|
253
|
+
parser->error = C_EINVAL;
|
|
254
|
+
parser->errorCount++;
|
|
255
|
+
c_va_start(arguments, theFormat);
|
|
256
|
+
(*parser->reportError)(parser->console, parser->path ? parser->path->string : C_NULL, line, theFormat, arguments);
|
|
257
|
+
c_va_end(arguments);
|
|
258
|
+
if (parser->console) {
|
|
259
|
+
parser->errorSymbol = parser->SyntaxErrorSymbol;
|
|
260
|
+
if (parser->buffer != theFormat) {
|
|
261
|
+
c_va_start(arguments, theFormat);
|
|
262
|
+
c_vsnprintf(parser->buffer, parser->bufferSize, theFormat, arguments);
|
|
263
|
+
c_va_end(arguments);
|
|
264
|
+
}
|
|
265
|
+
parser->errorMessage = fxNewParserString(parser, parser->buffer, mxStringLength(parser->buffer));
|
|
266
|
+
c_longjmp(parser->firstJump->jmp_buf, 1);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
void fxTerminateParser(txParser* parser)
|
|
271
|
+
{
|
|
272
|
+
fxDisposeParserChunks(parser);
|
|
273
|
+
if (parser->dtoa)
|
|
274
|
+
fxDelete_dtoa(parser->dtoa);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|