From 76f0f15077c4e3b530d70ac6258025c41f2e1979 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Mon, 2 Jul 2018 19:03:02 -0700 Subject: [PATCH] Remove code for comments --- src/clojure/clojure.contribution.ts | 10 +- src/clojure/clojure.test.ts | 164 +++++++++++++--------------- src/clojure/clojure.ts | 14 +-- 3 files changed, 81 insertions(+), 107 deletions(-) diff --git a/src/clojure/clojure.contribution.ts b/src/clojure/clojure.contribution.ts index a8c72682..fc0e885f 100644 --- a/src/clojure/clojure.contribution.ts +++ b/src/clojure/clojure.contribution.ts @@ -8,11 +8,11 @@ import { registerLanguage } from '../_.contribution'; // Allow for running under nodejs/requirejs in tests const _monaco: typeof monaco = - typeof monaco === 'undefined' ? (self).monaco : monaco; + typeof monaco === 'undefined' ? (self).monaco : monaco; registerLanguage({ - id: 'clojure', - extensions: ['.clj', '.clojure'], - aliases: ['clojure', 'Clojure'], - loader: () => _monaco.Promise.wrap(import('./clojure')), + id: 'clojure', + extensions: ['.clj', '.clojure'], + aliases: ['clojure', 'Clojure'], + loader: () => _monaco.Promise.wrap(import('./clojure')), }); diff --git a/src/clojure/clojure.test.ts b/src/clojure/clojure.test.ts index ab1bc64e..a4d1c1cb 100644 --- a/src/clojure/clojure.test.ts +++ b/src/clojure/clojure.test.ts @@ -8,97 +8,83 @@ import { testTokenization } from '../test/testRunner'; testTokenization('clojure', [ - // Keywords - [ - { - line: 'defmacro some', - tokens: [ - { startIndex: 0, type: 'keyword.clj' }, - { startIndex: 8, type: 'white.clj' }, - { startIndex: 9, type: 'variable.clj' }, - ], - }, + // Keywords + [ + { + line: 'defmacro some', + tokens: [ + { startIndex: 0, type: 'keyword.clj' }, + { startIndex: 8, type: 'white.clj' }, + { startIndex: 9, type: 'variable.clj' }, + ], + }, - { - line: 'comment "text comment"', - tokens: [ - { startIndex: 0, type: 'keyword.clj' }, - { startIndex: 7, type: 'white.clj'}, - { startIndex: 8, type: 'string.clj'}, - ], - }, - { - line: 'in-ns "user', - tokens: [ - { startIndex: 0, type: 'keyword.clj' }, - { startIndex: 5, type: 'white.clj' }, - { startIndex: 6, type: 'string.clj' }, - ], - }, - ], + { + line: 'comment "text comment"', + tokens: [ + { startIndex: 0, type: 'keyword.clj' }, + { startIndex: 7, type: 'white.clj' }, + { startIndex: 8, type: 'string.clj' }, + ], + }, + { + line: 'in-ns "user', + tokens: [ + { startIndex: 0, type: 'keyword.clj' }, + { startIndex: 5, type: 'white.clj' }, + { startIndex: 6, type: 'string.clj' }, + ], + }, + ], - // comments - [ - { - line: ';; comment', - tokens: [{ startIndex: 0, type: 'comment.clj' }], - }, - ], - [ - { - line: '(comment', - tokens: [{ startIndex: 0, type: 'comment.clj' }], - }, - { - line: '(comment let', - tokens: [ - { startIndex: 0, type: 'comment.clj' }, - { startIndex: 8, type: 'white.clj' }, - { startIndex: 9, type: 'keyword.clj' }, - ], - }, - ], + // comments + [ + { + line: ';; comment', + tokens: [{ startIndex: 0, type: 'comment.clj' }], + }, + ], - // strings - [ - { - line: '"\\n string "', - tokens: [ - { startIndex: 0, type: 'string.clj' }, - { startIndex: 1, type: 'string.escape.clj' }, - { startIndex: 3, type: 'string.clj' }, - ], - }, - ], - [ - { - line: '" string \\', - tokens: [{ startIndex: 0, type: 'string.clj' }], - }, - { - line: 'multiline', - tokens: [{ startIndex: 0, type: 'string.clj' }], - }, - { - line: ' ', - tokens: [ - // previous line needs to be terminated with \ - { startIndex: 0, type: 'white.clj' }, - ], - }, - ], + // strings + [ + { + line: '"\\n string "', + tokens: [ + { startIndex: 0, type: 'string.clj' }, + { startIndex: 1, type: 'string.escape.clj' }, + { startIndex: 3, type: 'string.clj' }, + ], + }, + ], + [ + { + line: '" string \\', + tokens: [{ startIndex: 0, type: 'string.clj' }], + }, + { + line: 'multiline', + tokens: [{ startIndex: 0, type: 'string.clj' }], + }, + { + line: ' ', + tokens: [ + // previous line needs to be terminated with \ + { startIndex: 0, type: 'white.clj' }, + ], + }, + ], - // numbers - [ - { - line: '1e2', - tokens: [{ startIndex: 0, type: 'number.float.clj' }], - }, - ], - [ - { - line: '#x03BB', - tokens: [{ startIndex: 0, type: 'number.hex.clj' }], - }, - ], + // numbers + [ + { + line: '1e2', + tokens: [{ startIndex: 0, type: 'number.float.clj' }], + }, + ], + [ + { + line: '#x03BB', + tokens: [{ startIndex: 0, type: 'number.hex.clj' }], + }, + ], ]); diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 82aef3b6..3e099e98 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -11,7 +11,6 @@ import ILanguage = monaco.languages.IMonarchLanguage; export const conf: IRichLanguageConfiguration = { comments: { lineComment: ';;', - blockComment: ['(comment', ')'], }, brackets: [['(', ')'], ['{', '}'], ['[', ']']], @@ -210,18 +209,7 @@ export const language = { { include: '@strings' }, ], - comment: [ - [/[^comment\(\)]+/, 'comment'], - [/\(comment/, 'comment', '@push'], - [/\)/, 'comment', '@pop'], - [/[comment\(\)]/, 'comment'], - ], - - whitespace: [ - [/[ \t\r\n]+/, 'white'], - [/\(comment/, 'comment', '@comment'], - [/;;.*$/, 'comment'], - ], + whitespace: [[/[ \t\r\n]+/, 'white'], [/;;.*$/, 'comment']], strings: [ [/"$/, 'string', '@popall'],