@@ -317,3 +317,62 @@ The token set of this particular DOMTokenList object are also known as the eleme
317
317
318
318
Issue(w3c/csswg-drafts#2414): Define this as a superglobal in the DOM spec.
319
319
Issue(w3c/csswg-drafts#2414): Define IDL for structured setting and getting of `exportparts`.
320
+
321
+ Microsyntaxes for parsing {#parsing}
322
+ ==============================================
323
+
324
+ Rules for parsing part mappings {#parsing-mapping}
325
+ ----------------------------------------------
326
+
327
+ A <span> valid part mapping</span> is a pair of DOMTokens
328
+ separated by a U+003A COLON charater,
329
+ with no other characters (e.g. no space characters).
330
+ The DOMTokens must not contain U+003A COLON or U+002C COMMA characters.
331
+
332
+ The rules for parsing a part mapping are as follows:
333
+
334
+ 1. Let <var> input</var> be the string being parsed.
335
+
336
+ 1. Let <var> position</var> be a pointer into <var> input</var> , initially pointing at the start of the string.
337
+
338
+ 1. <span> Collect a sequence of code points</span> that are space characters or U+003A COLON characters.
339
+ This skips past any leading delimiters.
340
+ 1. <span> Collect a sequence of code points</span> that are not space characters or U+003A COLON characters,
341
+ and let <var> first token</var> be the result.
342
+ 1. If <var> first token</var> is empty then return error.
343
+ 1. <span> Collect a sequence of code points</span> that are space characters.
344
+ 1. If the end of the <var> input</var> has been reached, return the pair <var> first token</var> , <var> first token</var>
345
+ 1. If character at <var> position</var> is not a U+003A COLON character, return error.
346
+ 1. Consume the U+003A COLON character.
347
+ 1. <span> Collect a sequence of code points</span> that are space characters.
348
+ 1. <span> Collect a sequence of code points</span> that are not space characters or U+003A COLON characters.
349
+ and let <var> second token</var> be the result.
350
+ 1. If <var> second token</var> is empty then return error.
351
+ 1. Return the pair <var> first token</var> , <var> second token</var> .
352
+
353
+ Rules for parsing a list of part mappings {#parsing-mapping-list}
354
+ ----------------------------------------------
355
+
356
+ A <span> valid list of part mappings</span> is a number of valid part mappings
357
+ separated by a U+002C COMMA charater,
358
+ with no other characters (e.g. no space characters).
359
+
360
+ The rules for parsing a list of part mappings are as follow:
361
+
362
+ 1. Let <var> input</var> be the string being parsed.
363
+
364
+ 1. Let <var> position</var> be a pointer into <var> input</var> , initially pointing at the start of the string.
365
+
366
+ 1. Let <var> mappings</var> be an initially empty list of pairs of DOMTokens.
367
+ This list will be the result of this algorithm.
368
+
369
+ 1. <span> Collect a sequence of code points</span> that are space characters, U+002C COMMA or U+003A COLON characters.
370
+ This skips past any leading delimiters.
371
+
372
+ 1. While <var> position</var> is not past the end of <var> input</var> :
373
+
374
+ 1. <span> Collect a sequence of code points</span> that are not U+002C COMMA characters,
375
+ and let <var> unparsed mapping</var> be the result.
376
+ 1. Let <var> mapping</var> be the result of parsing <var> unparsed mapping</var> using the <span> rules for parsing part mappings</span> .
377
+ 1. If <var> mapping</var> is an error, continue.
378
+ 1. Append <var> mapping</var> to <var> mappings</var> .
0 commit comments