MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxSourceMapValue

Function fxSourceMapValue

xs/sources/xsSourceMap.c:185–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183#define VLQ_MASK_BITS (VLQ_CONTINUATION_BIT - 1)
184
185txInteger fxSourceMapValue(txParser* parser, txString* p)
186{
187 txInteger continuation, digit = 0, result = 0, shift = 0;
188 txString q = *p;
189 do {
190 char c = *q++;
191 if (('A' <= c) && (c <= 'Z'))
192 digit = c - 'A';
193 else if (('a' <= c) && (c <= 'z'))
194 digit = c - 'a' + 26;
195 else if (('0' <= c) && (c <= '9'))
196 digit = c - '0' + 52;
197 else if (c == '+')
198 digit = 62;
199 else if (c == '/')
200 digit = 63;
201 else
202 fxReportParserError(parser, parser->states[0].line, "source map: unexpected character");
203 continuation = digit & VLQ_CONTINUATION_BIT;
204 digit &= VLQ_MASK_BITS;
205 result += (digit << shift);
206 shift += VLQ_SHIFT;
207 } while (continuation);
208 *p = q;
209 shift = result >> 1;
210 return ((result & 1) == 1) ? -shift : shift;
211}
212
213
214

Callers 1

fxSourceMapLinesFunction · 0.85

Calls 1

fxReportParserErrorFunction · 0.85

Tested by

no test coverage detected