From 422ff199cadcb99a60790dc64ce0d64a44090197 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 25 May 2017 11:28:58 +0200 Subject: [PATCH] [less] update grammar --- extensions/less/syntaxes/less.tmLanguage.json | 17 +- .../test/colorize-results/14119_less.json | 13 +- .../test-cssvariables_less.json | 28 +- .../less/test/colorize-results/test_less.json | 280 ++++++++++++++++-- 4 files changed, 293 insertions(+), 45 deletions(-) diff --git a/extensions/less/syntaxes/less.tmLanguage.json b/extensions/less/syntaxes/less.tmLanguage.json index 902eb4e8d01..cd25b2a89b5 100644 --- a/extensions/less/syntaxes/less.tmLanguage.json +++ b/extensions/less/syntaxes/less.tmLanguage.json @@ -146,12 +146,7 @@ "name": "comment.block.css" }, { - "match": "[+-]?\\d*\\.?\\d+", - "name": "constant.numeric.css" - }, - { - "match": "(?<=[\\d])(ch|cm|deg|dpi|dpcm|dppx|em|ex|grad|in|mm|ms|pc|pt|px|rad|rem|turn|s|vh|vmin|vw)\\b|%", - "name": "keyword.other.unit.css" + "include": "source.css#numeric-values" }, { "captures": { @@ -281,13 +276,13 @@ ] }, { + "match": "(@|\\-\\-)[\\w-]+(?=\\s*)", + "name": "variable.other.less", "captures": { "1": { "name": "punctuation.definition.variable.less" } - }, - "match": "(?:@|\\-\\-)[a-zA-Z0-9_-][\\w-]*(?=\\s*)", - "name": "variable.other.less" + } }, { "include": "#variable_interpolation" @@ -516,7 +511,7 @@ "include": "#strings" }, { - "match": "(\\b|\\.{0,2}/).*\\b", + "match": "(\\b|\\.{0,2}/)[^)]*\\b", "name": "string.url.css" } ] @@ -546,5 +541,5 @@ "name": "support.function.any-method.builtin.less" } }, - "version": "https://github.com/atom/language-less/commit/7d70b66aa9c853d59e27cce25b5bc25cb067e75a" + "version": "https://github.com/atom/language-less/commit/4661d870784f725599e438bf683553cc6cf0f4ed" } \ No newline at end of file diff --git a/extensions/less/test/colorize-results/14119_less.json b/extensions/less/test/colorize-results/14119_less.json index 6e89b6a4587..0c83af45331 100644 --- a/extensions/less/test/colorize-results/14119_less.json +++ b/extensions/less/test/colorize-results/14119_less.json @@ -33,7 +33,18 @@ } }, { - "c": "@hm", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "hm", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", diff --git a/extensions/less/test/colorize-results/test-cssvariables_less.json b/extensions/less/test/colorize-results/test-cssvariables_less.json index bca9cd3c3a9..1c9b8658a0a 100644 --- a/extensions/less/test/colorize-results/test-cssvariables_less.json +++ b/extensions/less/test/colorize-results/test-cssvariables_less.json @@ -55,7 +55,18 @@ } }, { - "c": "--spacing-unit", + "c": "--", + "t": "source.css.less meta.property-list.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "spacing-unit", "t": "source.css.less meta.property-list.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -100,7 +111,7 @@ }, { "c": "px", - "t": "source.css.less meta.property-list.css meta.property-value.css keyword.other.unit.css", + "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A", @@ -132,7 +143,18 @@ } }, { - "c": "--cell-padding", + "c": "--", + "t": "source.css.less meta.property-list.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "cell-padding", "t": "source.css.less meta.property-list.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", diff --git a/extensions/less/test/colorize-results/test_less.json b/extensions/less/test/colorize-results/test_less.json index 4cc47220238..d6b39257feb 100644 --- a/extensions/less/test/colorize-results/test_less.json +++ b/extensions/less/test/colorize-results/test_less.json @@ -308,7 +308,18 @@ } }, { - "c": "@base", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "base", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -385,7 +396,18 @@ } }, { - "c": "@style", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "style", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -418,7 +440,18 @@ } }, { - "c": "@c", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "c", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -506,7 +539,18 @@ } }, { - "c": "@c", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "c", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -594,7 +638,18 @@ } }, { - "c": "@style", + "c": "@", + "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "style", "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -616,7 +671,18 @@ } }, { - "c": "@c", + "c": "@", + "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "c", "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -671,7 +737,18 @@ } }, { - "c": "@style", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "style", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -704,7 +781,18 @@ } }, { - "c": "@alpha", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "alpha", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -749,7 +837,7 @@ }, { "c": "%", - "t": "source.css.less keyword.other.unit.css", + "t": "source.css.less constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A", @@ -836,7 +924,18 @@ } }, { - "c": "@alpha", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "alpha", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -913,7 +1012,18 @@ } }, { - "c": "@style", + "c": "@", + "t": "source.css.less meta.property-list.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "style", "t": "source.css.less meta.property-list.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -1232,7 +1342,18 @@ } }, { - "c": "@base", + "c": "@", + "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "base", "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -1277,7 +1398,7 @@ }, { "c": "%", - "t": "source.css.less meta.property-list.css meta.property-value.css keyword.other.unit.css", + "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A", @@ -1375,7 +1496,18 @@ } }, { - "c": "@base", + "c": "@", + "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "base", "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -1420,7 +1552,7 @@ }, { "c": "%", - "t": "source.css.less meta.property-list.css meta.property-value.css keyword.other.unit.css", + "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A", @@ -1585,7 +1717,7 @@ }, { "c": "px", - "t": "source.css.less meta.property-list.css meta.property-list.css keyword.other.unit.css", + "t": "source.css.less meta.property-list.css meta.property-list.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A", @@ -1640,7 +1772,7 @@ }, { "c": "%", - "t": "source.css.less meta.property-list.css meta.property-list.css keyword.other.unit.css", + "t": "source.css.less meta.property-list.css meta.property-list.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A", @@ -1849,7 +1981,7 @@ }, { "c": "px", - "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-value.css keyword.other.unit.css", + "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A", @@ -2058,7 +2190,7 @@ }, { "c": "px", - "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-value.css keyword.other.unit.css", + "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A", @@ -2311,7 +2443,7 @@ }, { "c": "px", - "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-list.css meta.property-list.css meta.property-value.css keyword.other.unit.css", + "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-list.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A", @@ -2398,7 +2530,18 @@ } }, { - "c": "@the-border", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "the-border", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -2443,7 +2586,7 @@ }, { "c": "px", - "t": "source.css.less keyword.other.unit.css", + "t": "source.css.less constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A", @@ -2464,7 +2607,18 @@ } }, { - "c": "@base-color", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "base-color", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -2519,7 +2673,18 @@ } }, { - "c": "@red", + "c": "@", + "t": "source.css.less variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "red", "t": "source.css.less variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -2673,7 +2838,18 @@ } }, { - "c": "@base-color", + "c": "@", + "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "base-color", "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -2794,7 +2970,18 @@ } }, { - "c": "@the-border", + "c": "@", + "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "the-border", "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -2871,7 +3058,18 @@ } }, { - "c": "@the-border", + "c": "@", + "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "the-border", "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -3058,7 +3256,18 @@ } }, { - "c": "@base-color", + "c": "@", + "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "base-color", "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -3201,7 +3410,18 @@ } }, { - "c": "@red", + "c": "@", + "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less punctuation.definition.variable.less", + "r": { + "dark_plus": "variable.other.less: #9CDCFE", + "light_plus": "variable.other.less: #FF0000", + "dark_vs": "variable.other.less: #9CDCFE", + "light_vs": "variable.other.less: #FF0000", + "hc_black": "variable.other.less: #D4D4D4" + } + }, + { + "c": "red", "t": "source.css.less meta.property-list.css meta.property-value.css variable.other.less", "r": { "dark_plus": "variable.other.less: #9CDCFE", @@ -3246,7 +3466,7 @@ }, { "c": "%", - "t": "source.css.less meta.property-list.css meta.property-value.css keyword.other.unit.css", + "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", "light_plus": "keyword.other.unit: #09885A",