aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/css-tree/lib/lexer/error.js
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-14 14:46:37 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-14 14:46:37 -0800
commitafa87af01c79a9baa539f2992d32154d2a4739bd (patch)
tree92c7416db734270a2fee1d72ee9cc119379ff8e1 /vanilla/node_modules/css-tree/lib/lexer/error.js
parent3b927e84d200402281f68181cd4253bc77e5528d (diff)
downloadneko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.gz
neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.bz2
neko-afa87af01c79a9baa539f2992d32154d2a4739bd.zip
task: delete vanilla js prototype\n\n- Removed vanilla/ directory and web/dist/vanilla directory\n- Updated Makefile, Dockerfile, and CI workflow to remove vanilla references\n- Cleaned up web/web.go to remove vanilla embed and routes\n- Verified build and tests pass\n\nCloses NK-2tcnmq
Diffstat (limited to 'vanilla/node_modules/css-tree/lib/lexer/error.js')
-rw-r--r--vanilla/node_modules/css-tree/lib/lexer/error.js123
1 files changed, 0 insertions, 123 deletions
diff --git a/vanilla/node_modules/css-tree/lib/lexer/error.js b/vanilla/node_modules/css-tree/lib/lexer/error.js
deleted file mode 100644
index 89a5400..0000000
--- a/vanilla/node_modules/css-tree/lib/lexer/error.js
+++ /dev/null
@@ -1,123 +0,0 @@
-import { createCustomError } from '../utils/create-custom-error.js';
-import { generate } from '../definition-syntax/generate.js';
-
-const defaultLoc = { offset: 0, line: 1, column: 1 };
-
-function locateMismatch(matchResult, node) {
- const tokens = matchResult.tokens;
- const longestMatch = matchResult.longestMatch;
- const mismatchNode = longestMatch < tokens.length ? tokens[longestMatch].node || null : null;
- const badNode = mismatchNode !== node ? mismatchNode : null;
- let mismatchOffset = 0;
- let mismatchLength = 0;
- let entries = 0;
- let css = '';
- let start;
- let end;
-
- for (let i = 0; i < tokens.length; i++) {
- const token = tokens[i].value;
-
- if (i === longestMatch) {
- mismatchLength = token.length;
- mismatchOffset = css.length;
- }
-
- if (badNode !== null && tokens[i].node === badNode) {
- if (i <= longestMatch) {
- entries++;
- } else {
- entries = 0;
- }
- }
-
- css += token;
- }
-
- if (longestMatch === tokens.length || entries > 1) { // last
- start = fromLoc(badNode || node, 'end') || buildLoc(defaultLoc, css);
- end = buildLoc(start);
- } else {
- start = fromLoc(badNode, 'start') ||
- buildLoc(fromLoc(node, 'start') || defaultLoc, css.slice(0, mismatchOffset));
- end = fromLoc(badNode, 'end') ||
- buildLoc(start, css.substr(mismatchOffset, mismatchLength));
- }
-
- return {
- css,
- mismatchOffset,
- mismatchLength,
- start,
- end
- };
-}
-
-function fromLoc(node, point) {
- const value = node && node.loc && node.loc[point];
-
- if (value) {
- return 'line' in value ? buildLoc(value) : value;
- }
-
- return null;
-}
-
-function buildLoc({ offset, line, column }, extra) {
- const loc = {
- offset,
- line,
- column
- };
-
- if (extra) {
- const lines = extra.split(/\n|\r\n?|\f/);
-
- loc.offset += extra.length;
- loc.line += lines.length - 1;
- loc.column = lines.length === 1 ? loc.column + extra.length : lines.pop().length + 1;
- }
-
- return loc;
-}
-
-export const SyntaxReferenceError = function(type, referenceName) {
- const error = createCustomError(
- 'SyntaxReferenceError',
- type + (referenceName ? ' `' + referenceName + '`' : '')
- );
-
- error.reference = referenceName;
-
- return error;
-};
-
-export const SyntaxMatchError = function(message, syntax, node, matchResult) {
- const error = createCustomError('SyntaxMatchError', message);
- const {
- css,
- mismatchOffset,
- mismatchLength,
- start,
- end
- } = locateMismatch(matchResult, node);
-
- error.rawMessage = message;
- error.syntax = syntax ? generate(syntax) : '<generic>';
- error.css = css;
- error.mismatchOffset = mismatchOffset;
- error.mismatchLength = mismatchLength;
- error.message = message + '\n' +
- ' syntax: ' + error.syntax + '\n' +
- ' value: ' + (css || '<empty string>') + '\n' +
- ' --------' + new Array(error.mismatchOffset + 1).join('-') + '^';
-
- Object.assign(error, start);
- error.loc = {
- source: (node && node.loc && node.loc.source) || '<unknown>',
- start,
- end
- };
-
- return error;
-};