deploy: v0.12 存档迁移+考古日志滚动条

This commit is contained in:
2026-06-24 03:04:38 +00:00
parent 4831505ef9
commit b4c6111516
58986 changed files with 7569452 additions and 31667 deletions
+144
View File
@@ -0,0 +1,144 @@
# Function calls
a {
color: rgba(0, 255, 0, 0.5);
}
==>
StyleSheet(
RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(NumberLiteral,NumberLiteral,NumberLiteral,NumberLiteral))))))
# Calls where each argument has multiple values
div {
background: repeating-linear-gradient(red, orange 50px);
clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%)
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(ValueName,ValueName,NumberLiteral(Unit)))),
Declaration(PropertyName,CallExpression(Callee,ArgList(
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit)))))))
# Color literals
a {
b: #fafd04;
c: #fafd0401;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,ColorLiteral),
Declaration(PropertyName,ColorLiteral))))
# Numbers
a {
b: 0.5%;
c: 5em;
margin: 10E3px;
margin: -456.8px;
margin: -0.0px;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)))))
# Binary arithmetic operators
a {
width: calc(100% - 80px);
aspect-ratio: 1/2;
font-size: calc(10px + (56 - 10) * ((100vw - 320px) / (1920 - 320)));
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(BinaryExpression(NumberLiteral(Unit),BinOp,NumberLiteral(Unit))))),
Declaration(PropertyName,BinaryExpression(NumberLiteral,BinOp,NumberLiteral)),
Declaration(PropertyName,CallExpression(Callee,ArgList(
BinaryExpression(BinaryExpression(NumberLiteral(Unit),BinOp,ParenthesizedValue(
BinaryExpression(NumberLiteral,BinOp,NumberLiteral))),BinOp,ParenthesizedValue(
BinaryExpression(ParenthesizedValue(BinaryExpression(NumberLiteral(Unit),BinOp,NumberLiteral(Unit))),BinOp,
ParenthesizedValue(BinaryExpression(NumberLiteral,BinOp,NumberLiteral)))))))))))
# Strings
a {
b: '';
c: '\'hi\'';
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,StringLiteral),Declaration(PropertyName,StringLiteral))))
# URLs
a {
b: url(http://something-else?foo=bar);
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,CallLiteral(CallTag,ParenthesizedContent)))))
# Important declarations
a {
b: c !important;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,ValueName,Important))))
# Comments right after numbers
a {
shape-outside: circle(20em/*=*/at 50% 50%);
shape-outside: inset(1em, 1em, 1em, 1em);
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(NumberLiteral(Unit),Comment,ValueName,NumberLiteral(Unit),NumberLiteral(Unit)))),
Declaration(PropertyName,CallExpression(Callee,ArgList(NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit)))))))
# Unfinished rule
a { foo: 2
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,NumberLiteral),⚠)))
# Variable names
foo {
--my-variable: white;
color: var(--my-variable);
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(VariableName,ValueName),
Declaration(PropertyName,CallExpression(Callee,ArgList(VariableName))))))
+361
View File
@@ -0,0 +1,361 @@
# Include
nav ul {
@include horizontal-list;
}
==>
StyleSheet(RuleSet(DescendantSelector(TagSelector(TagName),TagSelector(TagName)),Block(
IncludeStatement(include,ValueName))))
# Line comment
foo { // blah
// Something
color: green;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(LineComment,LineComment,Declaration(PropertyName,ValueName))))
# Top level properties
$color: red;
==>
StyleSheet(Declaration(SassVariableName,ValueName))
# Interpolation
#{$prefix} {
border-#{$stuff}-#{$side}: #{$value};
}
==>
StyleSheet(RuleSet(Interpolation(InterpolationStart,SassVariableName,InterpolationEnd),Block(
Declaration(Interpolation(InterpolationStart,SassVariableName,InterpolationContinue,SassVariableName,InterpolationEnd),
Interpolation(InterpolationStart,SassVariableName,InterpolationEnd)))))
# Mixin
@mixin reset-list {
padding: 0;
}
@mixin horizontal-list {
@include reset-list;
li {
display: inline-block;
margin: {
left: -2px;
right: 2em;
}
}
}
==>
StyleSheet(
MixinStatement(mixin,ValueName,Block(Declaration(PropertyName,NumberLiteral))),
MixinStatement(mixin,ValueName,Block(
IncludeStatement(include,ValueName),
RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,ValueName),
Declaration(PropertyName,Block(
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)))))))))
# Forward
@forward "src/list" hide list-reset, $horizontal-list-gap;
@forward "module" as m-*;
==>
StyleSheet(
ForwardStatement(forward,StringLiteral,Keyword,ValueName,SassVariableName),
ForwardStatement(forward,StringLiteral,Keyword,ValueName,Star))
# At-root
@mixin unify-parent($child) {
@at-root #{selector.unify(&, $child)} {
@content;
}
}
.wrapper .field {
@include unify-parent("input") {
/* ... */
}
@include unify-parent("select") {
/* ... */
}
}
==>
StyleSheet(
MixinStatement(mixin,CallExpression(Callee,ArgList(SassVariableName)),Block(
RootStatement(Interpolation(InterpolationStart,
NamespacedValue(ValueName,CallExpression(Callee,ArgList(NestingSelector,SassVariableName))),
InterpolationEnd),Block(AtRule(AtKeyword))))),
RuleSet(DescendantSelector(ClassSelector(ClassName),ClassSelector(ClassName)),Block(
IncludeStatement(include,CallExpression(Callee,ArgList(StringLiteral)),Block(Comment)),
IncludeStatement(include,CallExpression(Callee,ArgList(StringLiteral)),Block(Comment)))))
# Query At-root
@media print {
.page {
width: 8in;
@at-root (without: media) {
color: #111;
}
@at-root (with: rule) {
font-size: 1.2em;
}
}
}
==>
StyleSheet(MediaStatement(media,KeywordQuery,Block(
RuleSet(ClassSelector(ClassName),Block(
Declaration(PropertyName,NumberLiteral(Unit)),
RootStatement(Keyword,KeywordQuery,Block(Declaration(PropertyName,ColorLiteral))),
RootStatement(Keyword,KeywordQuery,Block(Declaration(PropertyName,NumberLiteral(Unit)))))))))
# Control flow
@function pow($base, $exponent) {
$result: 1;
@for $_ from 1 through $exponent {
$result: $result * $base;
}
@if $direction == up {
border-bottom-color: $color;
} @else if $direction == right {
border-left-color: $color;
} @else {
@error "Unknown direction #{$direction}.";
}
@while $one and $two < 55 {
$result: 0;
}
@return $result;
}
==>
StyleSheet(MixinStatement(mixin,CallExpression(Callee,ArgList(SassVariableName,SassVariableName)),Block(
Declaration(SassVariableName,NumberLiteral),
ForStatement(ControlKeyword,SassVariableName,Keyword,NumberLiteral,Keyword,SassVariableName,Block(
Declaration(SassVariableName,BinaryExpression(SassVariableName,BinOp,SassVariableName)))),
IfStatement(ControlKeyword,BinaryExpression(SassVariableName,BinOp,ValueName),Block(
Declaration(PropertyName,SassVariableName)
),ControlKeyword,Keyword,BinaryExpression(SassVariableName,BinOp,ValueName),Block(
Declaration(PropertyName,SassVariableName)
),ControlKeyword,Block(
OutputStatement(ControlKeyword,StringLiteral))),
WhileStatement(ControlKeyword,
BinaryExpression(BinaryExpression(SassVariableName,LogicOp,SassVariableName),BinOp,NumberLiteral),
Block(Declaration(SassVariableName,NumberLiteral))),OutputStatement(ControlKeyword,SassVariableName))))
# Indented {"dialect": "indented"}
@mixin button-base()
@include typography(button)
@include ripple-surface
@include ripple-radius-bounded
display: inline-flex
position: relative
height: $button-height
border: none
vertical-align: middle
&:hover
cursor: pointer
&:disabled
color: $mdc-button-disabled-ink-color
cursor: default
pointer-events: none
$i: 0
==>
StyleSheet(
MixinStatement(mixin,CallExpression(Callee,ArgList),Block(
IncludeStatement(include,CallExpression(Callee,ArgList(ValueName))),
IncludeStatement(include,ValueName),
IncludeStatement(include,ValueName),
Declaration(PropertyName,ValueName),
Declaration(PropertyName,ValueName),
Declaration(PropertyName,SassVariableName),
Declaration(PropertyName,ValueName),
Declaration(PropertyName,ValueName),
RuleSet(PseudoClassSelector(NestingSelector,PseudoClassName),Block(
Declaration(PropertyName,ValueName))),
RuleSet(PseudoClassSelector(NestingSelector,PseudoClassName),Block(
Declaration(PropertyName,SassVariableName),
Declaration(PropertyName,ValueName),
Declaration(PropertyName,ValueName))))),
Declaration(SassVariableName,NumberLiteral))
# Comments in indented {"dialect": "indented"}
// Nothing
p
/* blah
and more comment
color: blue
// More comments
display: /* inline block */ none
==>
StyleSheet(
LineComment,
RuleSet(TagSelector(TagName),Block(
Comment,
Declaration(PropertyName,ValueName),
LineComment,
Declaration(PropertyName,Comment,ValueName))))
# Indented mixin {"dialect": "indented"}
=reset-list
margin: 0
padding: 0
list-style: none
=horizontal-list
+reset-list
li
display: inline-block
margin:
left: -2px
right: 2em
nav ul
+horizontal-list
==>
StyleSheet(
MixinStatement(IndentedMixin,ValueName,Block(
Declaration(PropertyName,NumberLiteral),
Declaration(PropertyName,NumberLiteral),
Declaration(PropertyName,ValueName))),
MixinStatement(IndentedMixin,ValueName,Block(
IncludeStatement(IndentedInclude,ValueName),
RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,ValueName),
Declaration(PropertyName,Block(
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)))))))),
RuleSet(DescendantSelector(TagSelector(TagName),TagSelector(TagName)),Block(
IncludeStatement(IndentedInclude,ValueName))))
# Use
@use 'foundation/code';
@use "module" as m;
@use "module" as *;
@use 'library' with (
$black: #222,
$border-radius: 0.1rem
);
==>
StyleSheet(
UseStatement(use,StringLiteral),
UseStatement(use,StringLiteral,Keyword,ValueName),
UseStatement(use,StringLiteral,Keyword,Star),
UseStatement(use,StringLiteral,Keyword,ArgList(
SassVariableName, ColorLiteral,
SassVariableName,NumberLiteral(Unit))))
# Map declaration
$units: (
"px": 1px,
"rem": 1rem,
"%": 1%,
"em": 1em,
);
==>
StyleSheet(
Declaration(SassVariableName,":",Map("(",
StringLiteral,":",NumberLiteral(Unit),",",
StringLiteral,":",NumberLiteral(Unit),",",
StringLiteral,":",NumberLiteral(Unit),",",
StringLiteral,":",NumberLiteral(Unit),",",
")")),
";")
# Map declaration on a single line
$units: ("px": 1px, "rem": 1rem, "%": 1%, "em": 1em);
==>
StyleSheet(
Declaration(SassVariableName,":",Map("(",
StringLiteral,":",NumberLiteral(Unit),",",
StringLiteral,":",NumberLiteral(Unit),",",
StringLiteral,":",NumberLiteral(Unit),",",
StringLiteral,":",NumberLiteral(Unit),
")")),
";")
# Map of maps
$text-styles: (
"title": (
"small-screen": (
"font-size": $small-font-size,
"line-height": $small-line-height,
"font-weight": $small-font-weight,
),
"large-screen": (
"font-size": $base-font-size,
"line-height": $base-line-height,
"font-weight": $base-font-weight,
)
)
);
==>
StyleSheet(
Declaration(SassVariableName,":",Map("(",
StringLiteral,":",Map("(",
StringLiteral,":",Map("(",
StringLiteral,":",SassVariableName,",",
StringLiteral,":",SassVariableName,",",
StringLiteral,":",SassVariableName,",",
")"),",",
StringLiteral,":",Map("(",
StringLiteral,":",SassVariableName,",",
StringLiteral,":",SassVariableName,",",
StringLiteral,":",SassVariableName,",",
")"),
")"),
")")),
";")
+171
View File
@@ -0,0 +1,171 @@
# Universal selectors
* {}
==>
StyleSheet(RuleSet(UniversalSelector,Block))
# Type selectors
div, span {}
h1, h2, h3, h4 {}
==>
StyleSheet(
RuleSet(TagSelector(TagName),TagSelector(TagName),Block),
RuleSet(TagSelector(TagName),TagSelector(TagName),TagSelector(TagName),TagSelector(TagName),Block))
# Class selectors
.class-a {}
div.class-b, .class-c.class-d {}
==>
StyleSheet(
RuleSet(ClassSelector(ClassName),Block),
RuleSet(ClassSelector(TagSelector(TagName),ClassName),ClassSelector(ClassSelector(ClassName),ClassName),Block))
# Id selectors
#some-id, a#another-id {}
==>
StyleSheet(RuleSet(IdSelector(IdName),IdSelector(TagSelector(TagName),IdName),Block))
# Attribute selectors
[a] {}
[b=c] {}
[d~=e] {}
a[b] {}
==>
StyleSheet(
RuleSet(AttributeSelector(AttributeName),Block),
RuleSet(AttributeSelector(AttributeName,MatchOp,ValueName),Block),
RuleSet(AttributeSelector(AttributeName,MatchOp,ValueName),Block),
RuleSet(AttributeSelector(TagSelector(TagName),AttributeName),Block))
# Pseudo-class selectors
a:hover {}
:nth-child(2) {}
==>
StyleSheet(
RuleSet(PseudoClassSelector(TagSelector(TagName),":",PseudoClassName),Block),
RuleSet(PseudoClassSelector(":",PseudoClassName,ArgList(NumberLiteral)),Block))
# Pseudo-element selectors
a::first-line {}
==>
StyleSheet(RuleSet(PseudoClassSelector(TagSelector(TagName),"::",PseudoClassName),Block))
# Child selectors
a > b {}
c > d > e {}
==>
StyleSheet(
RuleSet(ChildSelector(TagSelector(TagName),ChildOp,TagSelector(TagName)),Block),
RuleSet(ChildSelector(ChildSelector(TagSelector(TagName),ChildOp,TagSelector(TagName)),ChildOp,TagSelector(TagName)),Block))
# Descendant selectors
a b {}
c d e {}
==>
StyleSheet(
RuleSet(DescendantSelector(TagSelector(TagName),TagSelector(TagName)),Block),
RuleSet(DescendantSelector(DescendantSelector(TagSelector(TagName),TagSelector(TagName)),TagSelector(TagName)),Block))
# Nesting selectors
a {
&.b {}
& c {}
& > d {}
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
RuleSet(ClassSelector(NestingSelector,ClassName),Block),
RuleSet(DescendantSelector(NestingSelector,TagSelector(TagName)),Block),
RuleSet(ChildSelector(NestingSelector,ChildOp,TagSelector(TagName)),Block))))
# Sibling selectors
a.b ~ c.d {}
.e.f + .g.h {}
==>
StyleSheet(
RuleSet(SiblingSelector(ClassSelector(TagSelector(TagName),ClassName),SiblingOp,ClassSelector(TagSelector(TagName),ClassName)),Block),
RuleSet(SiblingSelector(ClassSelector(ClassSelector(ClassName),ClassName),SiblingOp,ClassSelector(ClassSelector(ClassName),ClassName)),Block))
# The :not selector
a:not(:hover) {}
.b:not(c > .d) {}
==>
StyleSheet(
RuleSet(PseudoClassSelector(TagSelector(TagName),":",PseudoClassName,ArgList(PseudoClassSelector(":",PseudoClassName))),Block),
RuleSet(PseudoClassSelector(ClassSelector(ClassName),":",PseudoClassName,ArgList(ChildSelector(TagSelector(TagName),ChildOp,ClassSelector(ClassName)))),Block))
# Suffixed Outer
.foo {
&__bar {
}
}
==>
StyleSheet(RuleSet(ClassSelector(ClassName),Block(
RuleSet(SuffixedSelector(NestingSelector,Suffix),Block))))
# NestingSelector after selector
.foo {
.bar & {
}
}
==>
StyleSheet(RuleSet(ClassSelector(ClassName),Block(
RuleSet(DescendantSelector(ClassSelector(ClassName),NestingSelector),Block))))
# Placeholder selector
%theme-button {}
==>
StyleSheet(RuleSet(PlaceholderSelector(ClassName), Block))
# Placeholder selector after class selector
.primary-button, %theme-button {}
==>
StyleSheet(RuleSet(ClassSelector(ClassName),",",PlaceholderSelector(ClassName), Block))
+120
View File
@@ -0,0 +1,120 @@
# Empty stylesheets
/* Just a comment */
==>
StyleSheet(Comment)
# Import statements
@import url("fineprint.css") print;
@import url("bluish.css") speech;
@import 'custom.css';
@import url("chrome://communicator/skin/");
@import "common.css" screen;
==>
StyleSheet(
ImportStatement(import,CallLiteral(CallTag,StringLiteral),KeywordQuery),
ImportStatement(import,CallLiteral(CallTag,StringLiteral),KeywordQuery),
ImportStatement(import,StringLiteral),
ImportStatement(import,CallLiteral(CallTag,StringLiteral)),
ImportStatement(import,StringLiteral,KeywordQuery))
# Namespace statements
/* Default namespace */
@namespace url(XML-namespace-URL);
@namespace "XML-namespace-URL";
@namespace url(http://www.w3.org/1999/xhtml);
@namespace svg url(http://www.w3.org/2000/svg);
/* Prefixed namespace */
@namespace prefix url(XML-namespace-URL);
@namespace prefix "XML-namespace-URL";
==>
StyleSheet(
Comment,
NamespaceStatement(namespace,CallLiteral(CallTag,ParenthesizedContent)),
NamespaceStatement(namespace,StringLiteral),
NamespaceStatement(namespace,CallLiteral(CallTag,ParenthesizedContent)),
NamespaceStatement(namespace,NamespaceName,CallLiteral(CallTag,ParenthesizedContent)),
Comment,
NamespaceStatement(namespace,NamespaceName,CallLiteral(CallTag,ParenthesizedContent)),
NamespaceStatement(namespace,NamespaceName,StringLiteral))
# Keyframes statements
@keyframes important1 {
from { margin-top: 50px; }
50% { margin-top: 150px !important; } /* ignored */
to { margin-top: 100px; }
}
==>
StyleSheet(KeyframesStatement(keyframes,KeyframeName,KeyframeList(
KeyframeSelector(KeyframeRangeName),Block(Declaration(PropertyName,NumberLiteral(Unit))),
KeyframeSelector(NumberLiteral(Unit)),Block(Declaration(PropertyName,NumberLiteral(Unit),Important)),
Comment,
KeyframeSelector(KeyframeRangeName),Block(Declaration(PropertyName,NumberLiteral(Unit))))))
# Media statements
@media screen and (min-width: 30em) and (orientation: landscape) {}
@media (min-height: 680px), screen and (orientation: portrait) {}
@media not all and (monochrome) {}
@media only screen {}
==>
StyleSheet(
MediaStatement(media,BinaryQuery(BinaryQuery(KeywordQuery,LogicOp,FeatureQuery(FeatureName,NumberLiteral(Unit))),LogicOp,
FeatureQuery(FeatureName,ValueName)),Block),
MediaStatement(media,FeatureQuery(FeatureName,NumberLiteral(Unit)),BinaryQuery(KeywordQuery,LogicOp,FeatureQuery(FeatureName,ValueName)),Block),
MediaStatement(media,UnaryQuery(LogicOp,BinaryQuery(KeywordQuery,LogicOp,ParenthesizedQuery(KeywordQuery))),Block),
MediaStatement(media,UnaryQuery(LogicOp,KeywordQuery),Block))
# Supports statements
@supports (animation-name: test) {
div { animation-name: test; }
}
@supports (transform-style: preserve) or (-moz-transform-style: preserve) {}
@supports not ((text-align-last: justify) or (-moz-text-align-last: justify)) {}
@supports not selector(:matches(a, b)) {}
==>
StyleSheet(
SupportsStatement(supports,FeatureQuery(FeatureName,ValueName),Block(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,ValueName))))),
SupportsStatement(supports,BinaryQuery(FeatureQuery(FeatureName,ValueName),LogicOp,FeatureQuery(FeatureName,ValueName)),Block),
SupportsStatement(supports,UnaryQuery(LogicOp,ParenthesizedQuery(
BinaryQuery(FeatureQuery(FeatureName,ValueName),LogicOp,FeatureQuery(FeatureName,ValueName)))),Block),
SupportsStatement(supports,UnaryQuery(LogicOp,SelectorQuery(selector,PseudoClassSelector(":",PseudoClassName,ArgList(TagSelector(TagName),TagSelector(TagName))))),Block))
# Charset statements
@charset "utf-8";
==>
StyleSheet(CharsetStatement(charset,StringLiteral))
# Other at-statements
@font-face {
font-family: "Open Sans";
src: url("/a") format("woff2"), url("/b/c") format("woff");
}
==>
StyleSheet(AtRule(AtKeyword,Block(
Declaration(PropertyName,StringLiteral),
Declaration(PropertyName,CallLiteral(CallTag,StringLiteral),CallExpression(Callee,ArgList(StringLiteral)),
CallLiteral(CallTag,StringLiteral),CallExpression(Callee,ArgList(StringLiteral))))))
+16
View File
@@ -0,0 +1,16 @@
import {parser} from "../dist/index.js"
import {fileTests} from "@lezer/generator/dist/test"
import * as fs from "fs"
import * as path from "path"
import {fileURLToPath} from "url"
let caseDir = path.dirname(fileURLToPath(import.meta.url))
for (let file of fs.readdirSync(caseDir)) {
if (!/\.txt$/.test(file)) continue
let name = /^[^\.]*/.exec(file)[0]
describe(name, () => {
for (let {name, run} of fileTests(fs.readFileSync(path.join(caseDir, file), "utf8"), file))
it(name, () => run(parser))
})
}