Skip to content

Commit

Permalink
chore(parser): add some JSDoc annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
P0lip committed May 5, 2024
1 parent 8aa4726 commit 2f6ee9d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/parser/parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down

0 comments on commit 2f6ee9d

Please sign in to comment.