Remove code for comments

pull/2748/head
masad-frost 7 years ago
parent be0d51046c
commit 76f0f15077

@ -8,11 +8,11 @@ import { registerLanguage } from '../_.contribution';
// Allow for running under nodejs/requirejs in tests // Allow for running under nodejs/requirejs in tests
const _monaco: typeof monaco = const _monaco: typeof monaco =
typeof monaco === 'undefined' ? (<any>self).monaco : monaco; typeof monaco === 'undefined' ? (<any>self).monaco : monaco;
registerLanguage({ registerLanguage({
id: 'clojure', id: 'clojure',
extensions: ['.clj', '.clojure'], extensions: ['.clj', '.clojure'],
aliases: ['clojure', 'Clojure'], aliases: ['clojure', 'Clojure'],
loader: () => _monaco.Promise.wrap(import('./clojure')), loader: () => _monaco.Promise.wrap(import('./clojure')),
}); });

@ -8,97 +8,83 @@
import { testTokenization } from '../test/testRunner'; import { testTokenization } from '../test/testRunner';
testTokenization('clojure', [ testTokenization('clojure', [
// Keywords // Keywords
[ [
{ {
line: 'defmacro some', line: 'defmacro some',
tokens: [ tokens: [
{ startIndex: 0, type: 'keyword.clj' }, { startIndex: 0, type: 'keyword.clj' },
{ startIndex: 8, type: 'white.clj' }, { startIndex: 8, type: 'white.clj' },
{ startIndex: 9, type: 'variable.clj' }, { startIndex: 9, type: 'variable.clj' },
], ],
}, },
{ {
line: 'comment "text comment"', line: 'comment "text comment"',
tokens: [ tokens: [
{ startIndex: 0, type: 'keyword.clj' }, { startIndex: 0, type: 'keyword.clj' },
{ startIndex: 7, type: 'white.clj'}, { startIndex: 7, type: 'white.clj' },
{ startIndex: 8, type: 'string.clj'}, { startIndex: 8, type: 'string.clj' },
], ],
}, },
{ {
line: 'in-ns "user', line: 'in-ns "user',
tokens: [ tokens: [
{ startIndex: 0, type: 'keyword.clj' }, { startIndex: 0, type: 'keyword.clj' },
{ startIndex: 5, type: 'white.clj' }, { startIndex: 5, type: 'white.clj' },
{ startIndex: 6, type: 'string.clj' }, { startIndex: 6, type: 'string.clj' },
], ],
}, },
], ],
// comments // comments
[ [
{ {
line: ';; comment', line: ';; comment',
tokens: [{ startIndex: 0, type: 'comment.clj' }], 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' },
],
},
],
// strings // strings
[ [
{ {
line: '"\\n string "', line: '"\\n string "',
tokens: [ tokens: [
{ startIndex: 0, type: 'string.clj' }, { startIndex: 0, type: 'string.clj' },
{ startIndex: 1, type: 'string.escape.clj' }, { startIndex: 1, type: 'string.escape.clj' },
{ startIndex: 3, type: 'string.clj' }, { startIndex: 3, type: 'string.clj' },
], ],
}, },
], ],
[ [
{ {
line: '" string \\', line: '" string \\',
tokens: [{ startIndex: 0, type: 'string.clj' }], tokens: [{ startIndex: 0, type: 'string.clj' }],
}, },
{ {
line: 'multiline', line: 'multiline',
tokens: [{ startIndex: 0, type: 'string.clj' }], tokens: [{ startIndex: 0, type: 'string.clj' }],
}, },
{ {
line: ' ', line: ' ',
tokens: [ tokens: [
// previous line needs to be terminated with \ // previous line needs to be terminated with \
{ startIndex: 0, type: 'white.clj' }, { startIndex: 0, type: 'white.clj' },
], ],
}, },
], ],
// numbers // numbers
[ [
{ {
line: '1e2', line: '1e2',
tokens: [{ startIndex: 0, type: 'number.float.clj' }], tokens: [{ startIndex: 0, type: 'number.float.clj' }],
}, },
], ],
[ [
{ {
line: '#x03BB', line: '#x03BB',
tokens: [{ startIndex: 0, type: 'number.hex.clj' }], tokens: [{ startIndex: 0, type: 'number.hex.clj' }],
}, },
], ],
]); ]);

@ -11,7 +11,6 @@ import ILanguage = monaco.languages.IMonarchLanguage;
export const conf: IRichLanguageConfiguration = { export const conf: IRichLanguageConfiguration = {
comments: { comments: {
lineComment: ';;', lineComment: ';;',
blockComment: ['(comment', ')'],
}, },
brackets: [['(', ')'], ['{', '}'], ['[', ']']], brackets: [['(', ')'], ['{', '}'], ['[', ']']],
@ -210,18 +209,7 @@ export const language = <ILanguage>{
{ include: '@strings' }, { include: '@strings' },
], ],
comment: [ whitespace: [[/[ \t\r\n]+/, 'white'], [/;;.*$/, 'comment']],
[/[^comment\(\)]+/, 'comment'],
[/\(comment/, 'comment', '@push'],
[/\)/, 'comment', '@pop'],
[/[comment\(\)]/, 'comment'],
],
whitespace: [
[/[ \t\r\n]+/, 'white'],
[/\(comment/, 'comment', '@comment'],
[/;;.*$/, 'comment'],
],
strings: [ strings: [
[/"$/, 'string', '@popall'], [/"$/, 'string', '@popall'],

Loading…
Cancel
Save