Skip to content

Value Definition Syntax parser fails on @contents? #345

@tidoust

Description

@tidoust

The parser throws a SyntaxError: unexpected input when it bumps into an "at-keyword representing the start of an at-rule" (which is supposed to be a valid component value type) followed by a ?:

import { definitionSyntax } from 'css-tree';
const syntax = '@contents?';
const ast = definitionSyntax.parse(syntax);

Using grouping as in [@contents]? (or of course dropping the ? or the @) works, but the syntax looks valid to me, and it now appears in the syntax definition of the @mixin at-rule:

@mixin <function-token> <function-parameter>#? , @contents? )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions