Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly define FunctionExpression #3336

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions spec/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,28 @@ matching is case-insensitive.

## Syntax

<x><pre>
**FunctionExpression**¹ ::= [CssMinMax]
&#32; | [SpecialFunctionExpression]
&#32; | [CalculationExpression]
&#32; | FunctionCall
**FunctionCall**² ::= [NamespacedIdentifier] ArgumentInvocation
</pre></x>

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

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

2: `FunctionCall` may not have any whitespace between the `NamespacedIdentifier`
and the `ArgumentInvocation`. It may not start with [`SpecialFunctionName`],
`'calc('`, or `'clamp('` (case-insensitively).

[`SpecialFunctionName`]: #specialfunctionexpression

<x><pre>
**FunctionCall** ::= [NamespacedIdentifier][] ArgumentInvocation
</pre></x>
Expand Down
18 changes: 5 additions & 13 deletions spec/types/calculation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

* [Syntax](#syntax)
* [`CalculationExpression`](#calculationexpression)
* [`MinMaxExpression`](#minmaxexpression)
* [`CssMinMax`](#cssminmax)
* [Types](#types)
* [Operations](#operations)
* [Equality](#equality)
Expand All @@ -18,7 +18,7 @@
* [Semantics](#semantics)
* [`CalcExpression`](#calcexpression)
* [`ClampExpression`](#clampexpression)
* [`CssMinMax`](#cssminmax)
* [`CssMinMax`](#cssminmax-1)
* [`CalcArgument`](#calcargument)
* [`CalcSum`](#calcsum)
* [`CalcProduct`](#calcproduct)
Expand Down 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