MCPcopy
hub / github.com/webpack/webpack / parseAComponentValue

Function parseAComponentValue

lib/css/syntax.js:2166–2181  ·  view source on GitHub ↗
(input, pos, options = {})

Source from the content-addressed store, hash-verified

2164 * @returns {ComponentValue | undefined} the parsed component value, or `undefined` on empty / trailing-garbage input
2165 */
2166const parseAComponentValue = (input, pos, options = {}) => {
2167 // 1. Normalize input, and set input to the result.
2168 const ts = normalizeIntoTokenStream(input, pos, options.comment);
2169 useObjectBackend(ts.locConverter);
2170 // 2. Discard whitespace from input.
2171 while (ts.next().type === TT_WHITESPACE) ts.discard();
2172 // 3. If input is empty, return a syntax error.
2173 if (ts.next().type === TT_EOF) return undefined;
2174 // 4. Consume a component value from input and let value be the return value.
2175 const result = consumeAComponentValue(ts);
2176 // 5. Discard whitespace from input.
2177 while (ts.next().type === TT_WHITESPACE) ts.discard();
2178 // 6. If input is empty, return value. Otherwise, return a syntax error.
2179 if (ts.next().type === TT_EOF) return result;
2180 return undefined;
2181};
2182
2183/**
2184 * Parse a list of component values, CSS Syntax Level 3

Callers 3

cvFunction · 0.85
numFunction · 0.85

Calls 5

normalizeIntoTokenStreamFunction · 0.85
useObjectBackendFunction · 0.85
consumeAComponentValueFunction · 0.85
discardMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected