Skip to content

Commit 2341ea3

Browse files
committed
feat(ast): update AST with comment & position nodes
1 parent 6f57268 commit 2341ea3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

ast/node.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
import { Position } from "./token.ts";
2+
13
export interface Rule {
2-
type: "rule";
4+
type: string;
5+
text?: string;
36
selectors: string[];
47
declarations: Decl[];
8+
position?: Position;
59
}
610

711
export interface Decl {

example.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
import { parse } from "./core/parser/parser.ts";
2-
var ast = parse("p { color: black; }", {});
2+
var ast = parse(
3+
"/* comment */ p { color: black; }",
4+
{ position: true, comments: true },
5+
);
36
console.log(ast);

0 commit comments

Comments
 (0)