123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- /*---------------------------------------------------------------------------------------------
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *--------------------------------------------------------------------------------------------*/
- define(["require", "exports"], function (require, exports) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.conf = {
- comments: {
- lineComment: '#'
- },
- brackets: [
- ['{', '}'],
- ['[', ']'],
- ['(', ')']
- ],
- autoClosingPairs: [
- { open: '{', close: '}' },
- { open: '[', close: ']' },
- { open: '(', close: ')' },
- { open: '"', close: '"' },
- ],
- surroundingPairs: [
- { open: '{', close: '}' },
- { open: '[', close: ']' },
- { open: '(', close: ')' },
- { open: '"', close: '"' },
- ]
- };
- exports.language = {
- defaultToken: '',
- tokenPostfix: '.r',
- roxygen: [
- '@param',
- '@return',
- '@name',
- '@rdname',
- '@examples',
- '@include',
- '@docType',
- '@S3method',
- '@TODO',
- '@aliases',
- '@alias',
- '@assignee',
- '@author',
- '@callGraphDepth',
- '@callGraph',
- '@callGraphPrimitives',
- '@concept',
- '@exportClass',
- '@exportMethod',
- '@exportPattern',
- '@export',
- '@formals',
- '@format',
- '@importClassesFrom',
- '@importFrom',
- '@importMethodsFrom',
- '@import',
- '@keywords',
- '@method',
- '@nord',
- '@note',
- '@references',
- '@seealso',
- '@setClass',
- '@slot',
- '@source',
- '@title',
- '@usage'
- ],
- constants: [
- 'NULL',
- 'FALSE',
- 'TRUE',
- 'NA',
- 'Inf',
- 'NaN ',
- 'NA_integer_',
- 'NA_real_',
- 'NA_complex_',
- 'NA_character_ ',
- 'T',
- 'F',
- 'LETTERS',
- 'letters',
- 'month.abb',
- 'month.name',
- 'pi',
- 'R.version.string'
- ],
- keywords: [
- 'break',
- 'next',
- 'return',
- 'if',
- 'else',
- 'for',
- 'in',
- 'repeat',
- 'while',
- 'array',
- 'category',
- 'character',
- 'complex',
- 'double',
- 'function',
- 'integer',
- 'list',
- 'logical',
- 'matrix',
- 'numeric',
- 'vector',
- 'data.frame',
- 'factor',
- 'library',
- 'require',
- 'attach',
- 'detach',
- 'source'
- ],
- special: [
- '\\n',
- '\\r',
- '\\t',
- '\\b',
- '\\a',
- '\\f',
- '\\v',
- '\\\'',
- '\\"',
- '\\\\'
- ],
- brackets: [
- { open: '{', close: '}', token: 'delimiter.curly' },
- { open: '[', close: ']', token: 'delimiter.bracket' },
- { open: '(', close: ')', token: 'delimiter.parenthesis' }
- ],
- tokenizer: {
- root: [
- { include: '@numbers' },
- { include: '@strings' },
- [/[{}\[\]()]/, '@brackets'],
- { include: '@operators' },
- [/#'/, 'comment.doc', '@roxygen'],
- [/(^#.*$)/, 'comment'],
- [/\s+/, 'white'],
- [/[,:;]/, 'delimiter'],
- [/@[a-zA-Z]\w*/, 'tag'],
- [/[a-zA-Z]\w*/, {
- cases: {
- '@keywords': 'keyword',
- '@constants': 'constant',
- '@default': 'identifier'
- }
- }]
- ],
- // Recognize Roxygen comments
- roxygen: [
- [/@\w+/, {
- cases: {
- '@roxygen': 'tag',
- '@eos': { token: 'comment.doc', next: '@pop' },
- '@default': 'comment.doc'
- }
- }],
- [/\s+/, {
- cases: {
- '@eos': { token: 'comment.doc', next: '@pop' },
- '@default': 'comment.doc'
- }
- }],
- [/.*/, { token: 'comment.doc', next: '@pop' }]
- ],
- // Recognize positives, negatives, decimals, imaginaries, and scientific notation
- numbers: [
- [/0[xX][0-9a-fA-F]+/, 'number.hex'],
- [/-?(\d*\.)?\d+([eE][+\-]?\d+)?/, 'number']
- ],
- // Recognize operators
- operators: [
- [/<{1,2}-/, 'operator'],
- [/->{1,2}/, 'operator'],
- [/%[^%\s]+%/, 'operator'],
- [/\*\*/, 'operator'],
- [/%%/, 'operator'],
- [/&&/, 'operator'],
- [/\|\|/, 'operator'],
- [/<</, 'operator'],
- [/>>/, 'operator'],
- [/[-+=&|!<>^~*/:$]/, 'operator']
- ],
- // Recognize strings, including those broken across lines
- strings: [
- [/'/, 'string.escape', '@stringBody'],
- [/"/, 'string.escape', '@dblStringBody']
- ],
- stringBody: [
- [/\\./, {
- cases: {
- '@special': 'string',
- '@default': 'error-token'
- }
- }],
- [/'/, 'string.escape', '@popall'],
- [/./, 'string'],
- ],
- dblStringBody: [
- [/\\./, {
- cases: {
- '@special': 'string',
- '@default': 'error-token'
- }
- }],
- [/"/, 'string.escape', '@popall'],
- [/./, 'string'],
- ]
- }
- };
- });
|