aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/css-tree/lib/syntax/node/SupportsDeclaration.js
blob: ee816e5305d1435831da05678a55bba128b66f4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {
    LeftParenthesis,
    RightParenthesis
} from '../../tokenizer/index.js';

export const name = 'SupportsDeclaration';
export const structure = {
    declaration: 'Declaration'
};

export function parse() {
    const start = this.tokenStart;

    this.eat(LeftParenthesis);
    this.skipSC();

    const declaration = this.Declaration();

    if (!this.eof) {
        this.eat(RightParenthesis);
    }

    return {
        type: 'SupportsDeclaration',
        loc: this.getLocation(start, this.tokenStart),
        declaration
    };
}

export function generate(node) {
    this.token(LeftParenthesis, '(');
    this.node(node.declaration);
    this.token(RightParenthesis, ')');
}