summaryrefslogtreecommitdiff
path: root/node_modules/css-tree/lib/syntax/atrule
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/css-tree/lib/syntax/atrule')
-rw-r--r--node_modules/css-tree/lib/syntax/atrule/font-face.js8
-rw-r--r--node_modules/css-tree/lib/syntax/atrule/import.js39
-rw-r--r--node_modules/css-tree/lib/syntax/atrule/index.js15
-rw-r--r--node_modules/css-tree/lib/syntax/atrule/media.js12
-rw-r--r--node_modules/css-tree/lib/syntax/atrule/nest.js12
-rw-r--r--node_modules/css-tree/lib/syntax/atrule/page.js12
-rw-r--r--node_modules/css-tree/lib/syntax/atrule/supports.js80
7 files changed, 178 insertions, 0 deletions
diff --git a/node_modules/css-tree/lib/syntax/atrule/font-face.js b/node_modules/css-tree/lib/syntax/atrule/font-face.js
new file mode 100644
index 00000000..48a0570a
--- /dev/null
+++ b/node_modules/css-tree/lib/syntax/atrule/font-face.js
@@ -0,0 +1,8 @@
+export default {
+ parse: {
+ prelude: null,
+ block() {
+ return this.Block(true);
+ }
+ }
+};
diff --git a/node_modules/css-tree/lib/syntax/atrule/import.js b/node_modules/css-tree/lib/syntax/atrule/import.js
new file mode 100644
index 00000000..7403ad9e
--- /dev/null
+++ b/node_modules/css-tree/lib/syntax/atrule/import.js
@@ -0,0 +1,39 @@
+import {
+ String as StringToken,
+ Ident,
+ Url,
+ Function as FunctionToken,
+ LeftParenthesis
+} from '../../tokenizer/index.js';
+
+export default {
+ parse: {
+ prelude() {
+ const children = this.createList();
+
+ this.skipSC();
+
+ switch (this.tokenType) {
+ case StringToken:
+ children.push(this.String());
+ break;
+
+ case Url:
+ case FunctionToken:
+ children.push(this.Url());
+ break;
+
+ default:
+ this.error('String or url() is expected');
+ }
+
+ if (this.lookupNonWSType(0) === Ident ||
+ this.lookupNonWSType(0) === LeftParenthesis) {
+ children.push(this.MediaQueryList());
+ }
+
+ return children;
+ },
+ block: null
+ }
+};
diff --git a/node_modules/css-tree/lib/syntax/atrule/index.js b/node_modules/css-tree/lib/syntax/atrule/index.js
new file mode 100644
index 00000000..ff600e34
--- /dev/null
+++ b/node_modules/css-tree/lib/syntax/atrule/index.js
@@ -0,0 +1,15 @@
+import fontFace from './font-face.js';
+import importAtrule from './import.js';
+import media from './media.js';
+import nest from './nest.js';
+import page from './page.js';
+import supports from './supports.js';
+
+export default {
+ 'font-face': fontFace,
+ 'import': importAtrule,
+ media,
+ nest,
+ page,
+ supports
+};
diff --git a/node_modules/css-tree/lib/syntax/atrule/media.js b/node_modules/css-tree/lib/syntax/atrule/media.js
new file mode 100644
index 00000000..a9b0eb6e
--- /dev/null
+++ b/node_modules/css-tree/lib/syntax/atrule/media.js
@@ -0,0 +1,12 @@
+export default {
+ parse: {
+ prelude() {
+ return this.createSingleNodeList(
+ this.MediaQueryList()
+ );
+ },
+ block(isStyleBlock = false) {
+ return this.Block(isStyleBlock);
+ }
+ }
+};
diff --git a/node_modules/css-tree/lib/syntax/atrule/nest.js b/node_modules/css-tree/lib/syntax/atrule/nest.js
new file mode 100644
index 00000000..99fc15e5
--- /dev/null
+++ b/node_modules/css-tree/lib/syntax/atrule/nest.js
@@ -0,0 +1,12 @@
+export default {
+ parse: {
+ prelude() {
+ return this.createSingleNodeList(
+ this.SelectorList()
+ );
+ },
+ block() {
+ return this.Block(true);
+ }
+ }
+};
diff --git a/node_modules/css-tree/lib/syntax/atrule/page.js b/node_modules/css-tree/lib/syntax/atrule/page.js
new file mode 100644
index 00000000..99fc15e5
--- /dev/null
+++ b/node_modules/css-tree/lib/syntax/atrule/page.js
@@ -0,0 +1,12 @@
+export default {
+ parse: {
+ prelude() {
+ return this.createSingleNodeList(
+ this.SelectorList()
+ );
+ },
+ block() {
+ return this.Block(true);
+ }
+ }
+};
diff --git a/node_modules/css-tree/lib/syntax/atrule/supports.js b/node_modules/css-tree/lib/syntax/atrule/supports.js
new file mode 100644
index 00000000..9f8b56c6
--- /dev/null
+++ b/node_modules/css-tree/lib/syntax/atrule/supports.js
@@ -0,0 +1,80 @@
+import {
+ WhiteSpace,
+ Comment,
+ Ident,
+ Function,
+ Colon,
+ LeftParenthesis
+} from '../../tokenizer/index.js';
+
+function consumeRaw() {
+ return this.createSingleNodeList(
+ this.Raw(this.tokenIndex, null, false)
+ );
+}
+
+function parentheses() {
+ this.skipSC();
+
+ if (this.tokenType === Ident &&
+ this.lookupNonWSType(1) === Colon) {
+ return this.createSingleNodeList(
+ this.Declaration()
+ );
+ }
+
+ return readSequence.call(this);
+}
+
+function readSequence() {
+ const children = this.createList();
+ let child;
+
+ this.skipSC();
+
+ scan:
+ while (!this.eof) {
+ switch (this.tokenType) {
+ case Comment:
+ case WhiteSpace:
+ this.next();
+ continue;
+
+ case Function:
+ child = this.Function(consumeRaw, this.scope.AtrulePrelude);
+ break;
+
+ case Ident:
+ child = this.Identifier();
+ break;
+
+ case LeftParenthesis:
+ child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
+ break;
+
+ default:
+ break scan;
+ }
+
+ children.push(child);
+ }
+
+ return children;
+}
+
+export default {
+ parse: {
+ prelude() {
+ const children = readSequence.call(this);
+
+ if (this.getFirstListNode(children) === null) {
+ this.error('Condition is expected');
+ }
+
+ return children;
+ },
+ block(isStyleBlock = false) {
+ return this.Block(isStyleBlock);
+ }
+ }
+};