Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
33
Frontend-Learner/node_modules/parse-imports-exports/backtickString.cjs
generated
vendored
Normal file
33
Frontend-Learner/node_modules/parse-imports-exports/backtickString.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
'use strict';
|
||||
exports.onBacktickError = undefined;
|
||||
exports.onBacktickParse = undefined;
|
||||
const { addError } = require('./utils.cjs');
|
||||
/**
|
||||
* Adds error of parsing string literal started with backtick.
|
||||
*/
|
||||
const onBacktickError = exports.onBacktickError = (importsExports, _source, { start, end }) => addError(importsExports, 'Cannot find end of string literal started with backtick', start, end);
|
||||
/**
|
||||
* Parses string literal started with backtick.
|
||||
*/
|
||||
const onBacktickParse = exports.onBacktickParse = (importsExports, source, parsedToken) => {
|
||||
var depth = 0;
|
||||
var index = parsedToken.end;
|
||||
for (; index < source.length; index += 1) {
|
||||
const char = source[index];
|
||||
if (char === '$') {
|
||||
if (source[index + 1] === '{' && source[index - 1] !== '\\') {
|
||||
depth += 1;
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
else if (char === '}') {
|
||||
if (depth !== 0) {
|
||||
depth -= 1;
|
||||
}
|
||||
}
|
||||
else if (depth === 0 && char === '`' && source[index - 1] !== '\\') {
|
||||
return index + 1;
|
||||
}
|
||||
}
|
||||
return addError(importsExports, 'Cannot find end of nested string literal started with backtick', parsedToken.start, source.length);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue