Преглед изворни кода

[clojure] treat comma as whitespace

Abdussalam Abdurrahman пре 6 година
родитељ
комит
67eac92a0c
2 измењених фајлова са 20 додато и 2 уклоњено
  1. 19 1
      src/clojure/clojure.test.ts
  2. 1 1
      src/clojure/clojure.ts

+ 19 - 1
src/clojure/clojure.test.ts

@@ -897,5 +897,23 @@ testTokenization('clojure', [
 		'`',
 		'~',
 		"'",
-	], 'meta')
+	], 'meta'),
+
+	// treat comma as whitespace
+	[
+		{
+			line: ', foo, :bar, "one", 2, ',
+			tokens: [
+				{startIndex: 0, type: 'white.clj'},
+				{startIndex: 2, type: 'identifier.clj'},
+				{startIndex: 5, type: 'white.clj'},
+				{startIndex: 7, type: 'constant.clj'},
+				{startIndex: 11, type: 'white.clj'},
+				{startIndex: 13, type: 'string.clj'},
+				{startIndex: 18, type: 'white.clj'},
+				{startIndex: 20, type: 'number.clj'},
+				{startIndex: 21, type: 'white.clj'}
+			]
+		}
+	]
 ]);

+ 1 - 1
src/clojure/clojure.ts

@@ -768,7 +768,7 @@ export const language = <ILanguage>{
 		],
 
 		whitespace: [
-			[/\s+/, 'white'],
+			[/[\s,]+/, 'white'],
 			[/;.*$/, 'comment'],
 			[/\(comment\b/, 'comment', '@comment'],
 		],