Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Parse pseudo-class function arguments#62

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

flavorjones
Copy link
Collaborator

Previously,PseudoClassFunction arguments were simply a copy of theFunction token arguments. So from a selector of".flex:not(div, span.wide, .hidden)", thenot function would have these arguments in the AST:

[(ident-token "div"), (comma-token), (whitespace-token " "), (ident-token "span"), (delim-token "."), (ident-token "wide"), (comma-token), (whitespace-token " "), (delim-token "."), (ident-token "hidden")]

Now the arguments are parsed, so that aPseudoClassFunction is represented fully in the AST as something like:

(pseudo-class-selector  (pseudo-class-function    "not"    (arguments      (type-selector (wqname (ident-token "div"))),      (compound-selector        (type (type-selector (wqname (ident-token "span"))))        (subclasses          (class-selector (ident-token "wide"))        )        (pseudo-elements)      ),      (class-selector (ident-token "hidden"))    )  ))

so that the AST doesn't just contain tokens. Previously the argumentswere something like```[(ident-token "div"), (comma-token), (whitespace-token " "), (ident-token "span"), (delim-token "."), (ident-token "wide"), (comma-token), (whitespace-token " "), (delim-token "."), (ident-token "hidden")]```Now those tokens will be represented in the AST as```[(type-selector (wqname (ident-token "div"))), (compound-selector   (type (type-selector (wqname (ident-token "span"))))   (subclasses     (class-selector (ident-token "wide"))   )   (pseudo-elements) ), (class-selector (ident-token "hidden"))]```
@kddnewtonkddnewton merged commit5b84ed8 intoruby-syntax-tree:mainJun 28, 2024
2 checks passed
@kddnewton
Copy link
Member

This is a clever way to do it!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@kddnewtonkddnewtonkddnewton approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@flavorjones@kddnewton

[8]ページ先頭

©2009-2025 Movatter.jp