Skip to content

Commit 0bc1b8a

Browse files
committed
Minor things
1 parent 1a73040 commit 0bc1b8a

File tree

7 files changed

+10
-19
lines changed

7 files changed

+10
-19
lines changed

__tests__/value.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ describe('backtracking', () => {
550550
* 1. Replacing must only apply once (ie. not after backtracking).
551551
* 2. The list index must backtrack to a location stored in state instead of
552552
* from the index of a component value in the list.
553-
* 3. The list must not be updated with the result from parsing because it
553+
* 3. The list must not be updated with the result of parsing because it
554554
* may be different depending on the context production.
555555
*/
556556
test('replaced value', () => {

doc/parse/parser.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ A more generic solution is `preprocess(node)` executing any sub-routine associat
179179

180180
There are many semantic rules that can only be applied after matching the value definition, to validate the result against the context, or to create a different representation (eg. math functions and `<an+b>`). This can be achieved with `postprocess(node)` (or `validate(node)` and `represent(node)`).
181181

182-
All numeric values can be replaced with a math function. This can be achieved with `replace(node)` returning the result from parsing the alternative grammar.
182+
All numeric values can be replaced with a math function. This can be achieved with `replace(node)` returning the result of parsing the alternative grammar.
183183

184184

185185
## Implementation

lib/parse/arbitrary.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
import { associatedTokens, closingTokens, openingTokens } from '../values/blocks.js'
33
import { delimiter, list, omitted } from '../values/value.js'
4-
import { enterContext, getFunction, getRule, isInputAtEnd, isProducedBy } from '../utils/context.js'
54
import { getDeclarationDefinition, matchBlockContents, matchStyleSheet, parseGrammar } from './parser.js'
5+
import { getFunction, getRule, isInputAtEnd, isProducedBy } from '../utils/context.js'
66
import { isCloseCurlyBrace, isDelimiter, isError, isOpenCurlyBrace, isWhitespace } from '../utils/value.js'
77
import { create as createError } from '../error.js'
88

@@ -72,12 +72,6 @@ function matchCommaContainingValue(node, match) {
7272
const fn = getFunction(node)
7373
// Do not restrict functions defined with a general notation except custom function definitions
7474
if (fn && (fn.definition.name || isProducedBy(node, '<default-value>'))) {
75-
if (isInputAtEnd(node)) {
76-
if (parent?.definition.type === 'optional') {
77-
return omitted
78-
}
79-
return null
80-
}
8175
if (input.consume(isOpenCurlyBrace)) {
8276
const value = match(node, ['}'])
8377
if (isError(value)) {

lib/parse/postprocess.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,8 +1068,8 @@ function postParseMediaFeatureName(name, node) {
10681068
* It aborts parsing when the declaration value fails to be parsed against its
10691069
* definition.
10701070
*
1071-
* It represents the declaration value with the result from parsing it against
1072-
* the feature value definition.
1071+
* It represents the declaration value with the result of parsing it against the
1072+
* feature value definition.
10731073
*/
10741074
function postParseMediaFeaturePlain(declaration, node) {
10751075
const [name,, value] = declaration
@@ -1097,7 +1097,7 @@ function postParseMediaFeaturePlain(declaration, node) {
10971097
* It aborts parsing when the feature type is `discrete` or some value fails to
10981098
* be parsed against the feature value definition.
10991099
*
1100-
* It represents the range values with the result from parsing them against the
1100+
* It represents the range values with the result of parsing them against the
11011101
* feature value definition.
11021102
*/
11031103
function postParseMediaFeatureRange(range, node) {

lib/parse/tokenize.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
startsWithNumber,
1616
toNumber,
1717
} from '../utils/string.js'
18-
import Stream from './stream.js'
1918
import { create as error } from '../error.js'
2019

2120
/**
@@ -73,9 +72,7 @@ function consumeEscapedCodePoint(chars) {
7372
while (isHexadecimal(chars.next()) && hexCount++ < 5) {
7473
hex += chars.consume()
7574
}
76-
if (isWhitespace(chars.next())) {
77-
chars.consume()
78-
}
75+
chars.consume(isWhitespace)
7976
const number = Number(`0x${hex}`)
8077
if (number === 0 || isSurrogate(number) || number > 0x10FFFF) {
8178
return '�'

scripts/extract.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const replaced = {
173173
'<url-set>': '<image-set()>',
174174
'<whole-value>': '<declaration-value>?',
175175
'<zero>': '<number-token>',
176-
// https://github.com/w3c/reffy/issues/1878
176+
// https://github.com/w3c/csswg-drafts/issues/10457#issuecomment-3126400963
177177
'<boolean-expr-group>': '<test> | (<boolean-expr[<test>]>) | <general-enclosed>',
178178
// https://github.com/w3c/csswg-drafts/pull/8367#issuecomment-1408147460, https://github.com/w3c/csswg-drafts/issues/9729, https://github.com/w3c/csswg-drafts/issues/10833
179179
'<conic-gradient-syntax>': '[[[from [<angle> | <zero>]]? [at <position>]?]! || <color-interpolation-method>]? , <angular-color-stop-list>',

scripts/initial.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* This script rewrites property and descriptor definition files by replacing
33
* their `initial` value with an object associating:
44
*
5-
* - `parsed` to the result from parsing `initial`
6-
* - `serialized` to the result from serializing `parsed`
5+
* - `parsed` to the result of parsing `initial`
6+
* - `serialized` to the result of serializing `parsed`
77
*/
88
import { isFailure, isList, isOmitted } from '../lib/utils/value.js'
99
import { quote, tab } from '../lib/utils/string.js'

0 commit comments

Comments
 (0)