Skip to content

Commit

Permalink
Explicitly define FunctionExpression
Browse files Browse the repository at this point in the history
This sets the stage for modifying it to fix #3245
  • Loading branch information
nex3 committed Jun 16, 2022
1 parent 2a0c99b commit 5f96667
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
24 changes: 24 additions & 0 deletions spec/syntax.md
Expand Up @@ -71,6 +71,30 @@ No whitespace is allowed between components of an `InterpolatedUnquotedUrlConten
[identifier code point]: https://drafts.csswg.org/css-syntax-3/#identifier-code-point
[escape]: https://drafts.csswg.org/css-syntax-3/#escape-diagram

### `FunctionExpression`

<x><pre>
**FunctionExpression**¹ ::= [CssMinMax]
&#32; | SpecialFunctionExpression
&#32; | [CalculationExpression]
&#32; | FunctionCall
**FunctionCall** ::= FunctionName FunctionArguments ')'
**FunctionName**² ::= [NamespacedIdentifier] '('
</pre></x>

[CssMinMax]: types/calculation.md#cssminmax
[CalculationExpression]: types/calculation.md#calculationexpression
[NamespacedIdentifier]: modules.md#syntax

1: If both `CssMinMax` and `FunctionCall` could be consumed, `CssMinMax`
takes precedence.

2: `FunctionName` may not contain any whitespace, may not match
[`SpecialFunctionName`], and may not be case-insensitively equal to `'calc('`
or `'clamp('`.

[`SpecialFunctionName`]: #specialfunctionexpression

### `SpecialFunctionExpression`

> These functions are "special" in the sense that their arguments don't use the
Expand Down
14 changes: 3 additions & 11 deletions spec/types/calculation.md
Expand Up @@ -73,21 +73,13 @@ case-insensitively.
> expression regardless of syntax, for full compatibility it's necessary to
> parse it very expansively.
### `MinMaxExpression`

This production is parsed in a SassScript context when an expression is expected
and the input stream starts with an identifier with value `min` or `max`
(ignoring case) followed immediately by `(`.
### `CssMinMax`

<x><pre>
**MinMaxExpression**¹ ::= CssMinMax | FunctionExpression
**CssMinMax** ::= ('min(' | 'max(')² CalcArgument (',' CalcArgument)* ')'
**CssMinMax** ::= ('min(' | 'max(')¹ CalcArgument (',' CalcArgument)* ')'
</pre></x>

1: If both `CssMinMax` and `FunctionExpression` could be consumed, `CssMinMax`
takes precedence.

2: The strings `min(` and `max(` are matched case-insensitively.
1: The strings `min(` and `max(` are matched case-insensitively.

## Types

Expand Down

0 comments on commit 5f96667

Please sign in to comment.