From 2f6ee9d9063b6dc3fd70ddddc6673f84820f46db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ro=C5=BCek?= Date: Sun, 5 May 2024 19:54:37 +0200 Subject: [PATCH] chore(parser): add some JSDoc annotations --- src/parser/parser.mjs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/parser/parser.mjs b/src/parser/parser.mjs index 46df2ea..2b6a2d2 100644 --- a/src/parser/parser.mjs +++ b/src/parser/parser.mjs @@ -9,7 +9,34 @@ import { skipWhitespace, } from './utils.mjs'; +/** + * @typedef {WildcardExpression | MemberExpression | MultipleMemberExpression | SliceExpression | ScriptFilterExpression} Node + * + * @typedef {Object} WildcardExpression + * @property {boolean} deep - Indicates a descendant node. + * + * @typedef {Object} MemberExpression + * @property {string} value - The member name. + * @property {boolean} deep - Indicates a descendant node. + * + * @typedef {Object} MultipleMemberExpression + * @property {string[]} value - The member names. + * @property {boolean} deep - Indicates a descendant node. + * + * @typedef {Object} SliceExpression + * @property {[number, number, number]} value - The slice range. + * @property {boolean} deep - Indicates a descendant node. + * + * @typedef {Object} ScriptFilterExpression + * @property {string} raw - The raw expression. + * @property {*} value - The parsed expression. + */ + /* eslint-disable sort-keys */ +/** + * @param expr + * @returns {Node[]} + */ export function parser(expr) { if (expr.length === 0) { throw SyntaxError('Expected "$" but end of input found.');