utopia-project 0.37.6 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/context/documentation-guidelines.md +12 -7
- data/lib/utopia/project/import_map.rb +1 -0
- data/lib/utopia/project/version.rb +1 -1
- data/pages/_page.xnode +8 -13
- data/public/_components/@socketry/syntax/Syntax/CodeElement.js +293 -0
- data/public/_components/@socketry/syntax/Syntax/Errors.js +52 -0
- data/public/_components/@socketry/syntax/Syntax/Language/apache.js +49 -0
- data/public/_components/@socketry/syntax/Syntax/Language/applescript.js +157 -0
- data/public/_components/@socketry/syntax/Syntax/Language/assembly.js +42 -0
- data/public/_components/@socketry/syntax/Syntax/Language/bash-script.js +108 -0
- data/public/_components/@socketry/syntax/Syntax/Language/bash.js +32 -0
- data/public/_components/@socketry/syntax/Syntax/Language/basic.js +232 -0
- data/public/_components/@socketry/syntax/Syntax/Language/c++.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/c.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/clang.js +201 -0
- data/public/_components/@socketry/syntax/Syntax/Language/cpp.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/csharp.js +166 -0
- data/public/_components/@socketry/syntax/Syntax/Language/css.js +244 -0
- data/public/_components/@socketry/syntax/Syntax/Language/diff.js +24 -0
- data/public/_components/@socketry/syntax/Syntax/Language/go.js +135 -0
- data/public/_components/@socketry/syntax/Syntax/Language/haskell.js +110 -0
- data/public/_components/@socketry/syntax/Syntax/Language/html.js +69 -0
- data/public/_components/@socketry/syntax/Syntax/Language/io.js +68 -0
- data/public/_components/@socketry/syntax/Syntax/Language/java.js +134 -0
- data/public/_components/@socketry/syntax/Syntax/Language/javascript.js +89 -0
- data/public/_components/@socketry/syntax/Syntax/Language/json.js +36 -0
- data/public/_components/@socketry/syntax/Syntax/Language/lisp.js +38 -0
- data/public/_components/@socketry/syntax/Syntax/Language/lua.js +87 -0
- data/public/_components/@socketry/syntax/Syntax/Language/markdown.js +112 -0
- data/public/_components/@socketry/syntax/Syntax/Language/nginx.js +37 -0
- data/public/_components/@socketry/syntax/Syntax/Language/objective-c.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/ocaml.js +225 -0
- data/public/_components/@socketry/syntax/Syntax/Language/pascal.js +166 -0
- data/public/_components/@socketry/syntax/Syntax/Language/patch.js +2 -0
- data/public/_components/@socketry/syntax/Syntax/Language/perl5.js +317 -0
- data/public/_components/@socketry/syntax/Syntax/Language/php-script.js +112 -0
- data/public/_components/@socketry/syntax/Syntax/Language/php.js +18 -0
- data/public/_components/@socketry/syntax/Syntax/Language/plain.js +20 -0
- data/public/_components/@socketry/syntax/Syntax/Language/protobuf.js +77 -0
- data/public/_components/@socketry/syntax/Syntax/Language/python.js +208 -0
- data/public/_components/@socketry/syntax/Syntax/Language/ruby.js +124 -0
- data/public/_components/@socketry/syntax/Syntax/Language/scala.js +81 -0
- data/public/_components/@socketry/syntax/Syntax/Language/smalltalk.js +30 -0
- data/public/_components/@socketry/syntax/Syntax/Language/sql.js +865 -0
- data/public/_components/@socketry/syntax/Syntax/Language/super-collider.js +70 -0
- data/public/_components/@socketry/syntax/Syntax/Language/swift.js +176 -0
- data/public/_components/@socketry/syntax/Syntax/Language/xml.js +76 -0
- data/public/_components/@socketry/syntax/Syntax/Language/xrb.js +33 -0
- data/public/_components/@socketry/syntax/Syntax/Language/yaml.js +29 -0
- data/public/_components/@socketry/syntax/Syntax/Language.js +276 -0
- data/public/_components/@socketry/syntax/Syntax/Loader.js +78 -0
- data/public/_components/@socketry/syntax/Syntax/Match.js +546 -0
- data/public/_components/@socketry/syntax/Syntax/Rule.js +306 -0
- data/public/_components/@socketry/syntax/Syntax.js +356 -0
- data/public/_components/@socketry/syntax/license.md +21 -0
- data/public/_components/@socketry/syntax/package.json +43 -0
- data/public/_components/@socketry/syntax/readme.md +162 -0
- data/public/_components/@socketry/syntax/themes/base/apache.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/applescript.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/assembly.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/bash.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/basic.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/c.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/clang.css +0 -0
- data/public/_components/@socketry/syntax/themes/base/csharp.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/css.css +22 -0
- data/public/_components/@socketry/syntax/themes/base/diff.css +48 -0
- data/public/_components/@socketry/syntax/themes/base/go.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/haskell.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/html.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/io.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/java.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/javascript.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/json.css +41 -0
- data/public/_components/@socketry/syntax/themes/base/lisp.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/lua.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/markdown.css +16 -0
- data/public/_components/@socketry/syntax/themes/base/nginx.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/ocaml.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/pascal.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/perl5.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/php-script.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/php.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/plain.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/protobuf.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/python.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/ruby.css +23 -0
- data/public/_components/@socketry/syntax/themes/base/scala.css +3 -0
- data/public/_components/@socketry/syntax/themes/base/smalltalk.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/sql.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/super-collider.css +33 -0
- data/public/_components/@socketry/syntax/themes/base/swift.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/syntax.css +63 -0
- data/public/_components/@socketry/syntax/themes/base/xml.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/xrb.css +29 -0
- data/public/_components/@socketry/syntax/themes/base/yaml.css +1 -0
- data/public/_components/@socketry/syntax/themes/theming.md +233 -0
- data/public/_static/sidebar.js +55 -22
- data/public/_static/site.css +0 -4
- data.tar.gz.sig +0 -0
- metadata +94 -1
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('php-script');
|
|
5
|
+
|
|
6
|
+
const keywords = [
|
|
7
|
+
'abstract',
|
|
8
|
+
'and',
|
|
9
|
+
'as',
|
|
10
|
+
'break',
|
|
11
|
+
'case',
|
|
12
|
+
'cfunction',
|
|
13
|
+
'class',
|
|
14
|
+
'const',
|
|
15
|
+
'continue',
|
|
16
|
+
'declare',
|
|
17
|
+
'default',
|
|
18
|
+
'die',
|
|
19
|
+
'do',
|
|
20
|
+
'echo',
|
|
21
|
+
'else',
|
|
22
|
+
'elseif',
|
|
23
|
+
'enddeclare',
|
|
24
|
+
'endfor',
|
|
25
|
+
'endforeach',
|
|
26
|
+
'endif',
|
|
27
|
+
'endswitch',
|
|
28
|
+
'endwhile',
|
|
29
|
+
'extends',
|
|
30
|
+
'extends',
|
|
31
|
+
'for',
|
|
32
|
+
'foreach',
|
|
33
|
+
'function',
|
|
34
|
+
'global',
|
|
35
|
+
'if',
|
|
36
|
+
'implements',
|
|
37
|
+
'include',
|
|
38
|
+
'include_once',
|
|
39
|
+
'interface',
|
|
40
|
+
'old_function',
|
|
41
|
+
'or',
|
|
42
|
+
'require',
|
|
43
|
+
'require_once',
|
|
44
|
+
'return',
|
|
45
|
+
'static',
|
|
46
|
+
'switch',
|
|
47
|
+
'throw',
|
|
48
|
+
'use',
|
|
49
|
+
'var',
|
|
50
|
+
'while',
|
|
51
|
+
'xor'
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
const access = ['private', 'protected', 'public'];
|
|
55
|
+
|
|
56
|
+
const operators = [
|
|
57
|
+
'+',
|
|
58
|
+
'*',
|
|
59
|
+
'/',
|
|
60
|
+
'-',
|
|
61
|
+
'&',
|
|
62
|
+
'|',
|
|
63
|
+
'~',
|
|
64
|
+
'!',
|
|
65
|
+
'%',
|
|
66
|
+
'<',
|
|
67
|
+
'=',
|
|
68
|
+
'>',
|
|
69
|
+
'[',
|
|
70
|
+
']',
|
|
71
|
+
'new'
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
const values = ['this', 'true', 'false'];
|
|
75
|
+
|
|
76
|
+
language.push(values, {type: 'constant'});
|
|
77
|
+
language.push(keywords, {type: 'keyword'});
|
|
78
|
+
language.push(operators, {type: 'operator'});
|
|
79
|
+
language.push(access, {type: 'access'});
|
|
80
|
+
|
|
81
|
+
// Variables
|
|
82
|
+
language.push({
|
|
83
|
+
pattern: /\$[a-z_][a-z0-9]*/gi,
|
|
84
|
+
type: 'variable'
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// ClassNames (CamelCase)
|
|
88
|
+
language.push(Rule.camelCaseType);
|
|
89
|
+
language.push(Rule.cStyleFunction);
|
|
90
|
+
|
|
91
|
+
// Comments
|
|
92
|
+
language.push(Rule.cStyleComment);
|
|
93
|
+
language.push(Rule.cppStyleComment);
|
|
94
|
+
language.push(Rule.perlStyleComment);
|
|
95
|
+
language.push(Rule.webLink);
|
|
96
|
+
|
|
97
|
+
// Strings
|
|
98
|
+
language.push(Rule.singleQuotedString);
|
|
99
|
+
language.push(Rule.doubleQuotedString);
|
|
100
|
+
language.push(Rule.stringEscape);
|
|
101
|
+
|
|
102
|
+
// Numbers
|
|
103
|
+
language.push(Rule.decimalNumber);
|
|
104
|
+
language.push(Rule.hexNumber);
|
|
105
|
+
|
|
106
|
+
language.processes['function'] = Rule.webLinkProcess(
|
|
107
|
+
'http://www.php.net/manual-lookup.php?pattern='
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
export default function register(syntax) {
|
|
111
|
+
syntax.register('php-script', language);
|
|
112
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('php');
|
|
5
|
+
|
|
6
|
+
language.push({
|
|
7
|
+
pattern: /(<\?(php)?)([\s\S]*?)(\?>)/m,
|
|
8
|
+
matches: Rule.extractMatches(
|
|
9
|
+
{type: 'keyword'},
|
|
10
|
+
null,
|
|
11
|
+
{language: 'php-script'},
|
|
12
|
+
{type: 'keyword'}
|
|
13
|
+
)
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export default function register(syntax) {
|
|
17
|
+
syntax.register('php', language);
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('plain');
|
|
5
|
+
|
|
6
|
+
language.push(Rule.webLink);
|
|
7
|
+
|
|
8
|
+
// Process href types as clickable links
|
|
9
|
+
language.processes['href'] = function (container, match, options) {
|
|
10
|
+
const anchor = document.createElement('a');
|
|
11
|
+
anchor.className = container.className;
|
|
12
|
+
anchor.textContent = match.value;
|
|
13
|
+
anchor.href = match.value;
|
|
14
|
+
return anchor;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default function register(syntax) {
|
|
18
|
+
syntax.register('plain', language);
|
|
19
|
+
syntax.alias('plain', ['text']);
|
|
20
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('protobuf');
|
|
5
|
+
|
|
6
|
+
const keywords = [
|
|
7
|
+
'enum',
|
|
8
|
+
'extend',
|
|
9
|
+
'extensions',
|
|
10
|
+
'group',
|
|
11
|
+
'import',
|
|
12
|
+
'max',
|
|
13
|
+
'message',
|
|
14
|
+
'option',
|
|
15
|
+
'package',
|
|
16
|
+
'returns',
|
|
17
|
+
'rpc',
|
|
18
|
+
'service',
|
|
19
|
+
'syntax',
|
|
20
|
+
'to',
|
|
21
|
+
'default'
|
|
22
|
+
];
|
|
23
|
+
language.push(keywords, {type: 'keyword'});
|
|
24
|
+
|
|
25
|
+
const values = ['true', 'false'];
|
|
26
|
+
language.push(values, {type: 'constant'});
|
|
27
|
+
|
|
28
|
+
const types = [
|
|
29
|
+
'bool',
|
|
30
|
+
'bytes',
|
|
31
|
+
'double',
|
|
32
|
+
'fixed32',
|
|
33
|
+
'fixed64',
|
|
34
|
+
'float',
|
|
35
|
+
'int32',
|
|
36
|
+
'int64',
|
|
37
|
+
'sfixed32',
|
|
38
|
+
'sfixed64',
|
|
39
|
+
'sint32',
|
|
40
|
+
'sint64',
|
|
41
|
+
'string',
|
|
42
|
+
'uint32',
|
|
43
|
+
'uint64'
|
|
44
|
+
];
|
|
45
|
+
language.push(types, {type: 'type'});
|
|
46
|
+
|
|
47
|
+
const access = ['optional', 'required', 'repeated'];
|
|
48
|
+
language.push(access, {type: 'access'});
|
|
49
|
+
|
|
50
|
+
language.push(Rule.camelCaseType);
|
|
51
|
+
|
|
52
|
+
// Highlight names of fields
|
|
53
|
+
language.push({
|
|
54
|
+
pattern: /\s+(\w+)\s*=\s*\d+/,
|
|
55
|
+
matches: Rule.extractMatches({
|
|
56
|
+
type: 'variable'
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Comments
|
|
61
|
+
language.push(Rule.cppStyleComment);
|
|
62
|
+
language.push(Rule.cStyleComment);
|
|
63
|
+
language.push(Rule.webLink);
|
|
64
|
+
|
|
65
|
+
// Strings
|
|
66
|
+
language.push(Rule.singleQuotedString);
|
|
67
|
+
language.push(Rule.doubleQuotedString);
|
|
68
|
+
language.push(Rule.stringEscape);
|
|
69
|
+
|
|
70
|
+
// Numbers
|
|
71
|
+
language.push(Rule.decimalNumber);
|
|
72
|
+
language.push(Rule.hexNumber);
|
|
73
|
+
|
|
74
|
+
export default function register(syntax) {
|
|
75
|
+
syntax.register('protobuf', language);
|
|
76
|
+
syntax.alias('protobuf', ['proto']);
|
|
77
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('python');
|
|
5
|
+
|
|
6
|
+
var keywords = [
|
|
7
|
+
'and',
|
|
8
|
+
'as',
|
|
9
|
+
'assert',
|
|
10
|
+
'break',
|
|
11
|
+
'class',
|
|
12
|
+
'continue',
|
|
13
|
+
'def',
|
|
14
|
+
'del',
|
|
15
|
+
'elif',
|
|
16
|
+
'else',
|
|
17
|
+
'except',
|
|
18
|
+
'exec',
|
|
19
|
+
'finally',
|
|
20
|
+
'for',
|
|
21
|
+
'from',
|
|
22
|
+
'global',
|
|
23
|
+
'if',
|
|
24
|
+
'import',
|
|
25
|
+
'in',
|
|
26
|
+
'is',
|
|
27
|
+
'lambda',
|
|
28
|
+
'not',
|
|
29
|
+
'or',
|
|
30
|
+
'pass',
|
|
31
|
+
'print',
|
|
32
|
+
'raise',
|
|
33
|
+
'return',
|
|
34
|
+
'try',
|
|
35
|
+
'while',
|
|
36
|
+
'with',
|
|
37
|
+
'yield'
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
var operators = [
|
|
41
|
+
'!=',
|
|
42
|
+
'%',
|
|
43
|
+
'%=',
|
|
44
|
+
'&',
|
|
45
|
+
'&=',
|
|
46
|
+
'(',
|
|
47
|
+
')',
|
|
48
|
+
'*',
|
|
49
|
+
'**',
|
|
50
|
+
'**=',
|
|
51
|
+
'*=',
|
|
52
|
+
'+',
|
|
53
|
+
'+=',
|
|
54
|
+
',',
|
|
55
|
+
'-',
|
|
56
|
+
'-=',
|
|
57
|
+
'.',
|
|
58
|
+
'/',
|
|
59
|
+
'//',
|
|
60
|
+
'//=',
|
|
61
|
+
'/=',
|
|
62
|
+
':',
|
|
63
|
+
';',
|
|
64
|
+
'<',
|
|
65
|
+
'<<',
|
|
66
|
+
'<<=',
|
|
67
|
+
'<=',
|
|
68
|
+
'<>',
|
|
69
|
+
'=',
|
|
70
|
+
'==',
|
|
71
|
+
'>',
|
|
72
|
+
'>=',
|
|
73
|
+
'>>',
|
|
74
|
+
'>>=',
|
|
75
|
+
'@',
|
|
76
|
+
'[',
|
|
77
|
+
']',
|
|
78
|
+
'^',
|
|
79
|
+
'^=',
|
|
80
|
+
'`',
|
|
81
|
+
'`',
|
|
82
|
+
'{',
|
|
83
|
+
'|',
|
|
84
|
+
'|=',
|
|
85
|
+
'}',
|
|
86
|
+
'~'
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
// Extracted from http://docs.python.org/library/functions.html
|
|
90
|
+
var builtinFunctions = [
|
|
91
|
+
'abs',
|
|
92
|
+
'all',
|
|
93
|
+
'any',
|
|
94
|
+
'basestring',
|
|
95
|
+
'bin',
|
|
96
|
+
'bool',
|
|
97
|
+
'callable',
|
|
98
|
+
'chr',
|
|
99
|
+
'classmethod',
|
|
100
|
+
'cmp',
|
|
101
|
+
'compile',
|
|
102
|
+
'complex',
|
|
103
|
+
'delattr',
|
|
104
|
+
'dict',
|
|
105
|
+
'dir',
|
|
106
|
+
'divmod',
|
|
107
|
+
'enumerate',
|
|
108
|
+
'eval',
|
|
109
|
+
'execfile',
|
|
110
|
+
'file',
|
|
111
|
+
'filter',
|
|
112
|
+
'float',
|
|
113
|
+
'format',
|
|
114
|
+
'frozenset',
|
|
115
|
+
'getattr',
|
|
116
|
+
'globals',
|
|
117
|
+
'hasattr',
|
|
118
|
+
'hash',
|
|
119
|
+
'help',
|
|
120
|
+
'hex',
|
|
121
|
+
'id',
|
|
122
|
+
'input',
|
|
123
|
+
'int',
|
|
124
|
+
'isinstance',
|
|
125
|
+
'issubclass',
|
|
126
|
+
'iter',
|
|
127
|
+
'len',
|
|
128
|
+
'list',
|
|
129
|
+
'locals',
|
|
130
|
+
'long',
|
|
131
|
+
'map',
|
|
132
|
+
'max',
|
|
133
|
+
'min',
|
|
134
|
+
'next',
|
|
135
|
+
'object',
|
|
136
|
+
'oct',
|
|
137
|
+
'open',
|
|
138
|
+
'ord',
|
|
139
|
+
'pow',
|
|
140
|
+
'print',
|
|
141
|
+
'property',
|
|
142
|
+
'range',
|
|
143
|
+
'raw_input',
|
|
144
|
+
'reduce',
|
|
145
|
+
'reload',
|
|
146
|
+
'repr',
|
|
147
|
+
'reversed',
|
|
148
|
+
'round',
|
|
149
|
+
'set',
|
|
150
|
+
'setattr',
|
|
151
|
+
'slice',
|
|
152
|
+
'sorted',
|
|
153
|
+
'staticmethod',
|
|
154
|
+
'str',
|
|
155
|
+
'sum',
|
|
156
|
+
'super',
|
|
157
|
+
'tuple',
|
|
158
|
+
'type',
|
|
159
|
+
'type',
|
|
160
|
+
'unichr',
|
|
161
|
+
'unicode',
|
|
162
|
+
'vars',
|
|
163
|
+
'xrange',
|
|
164
|
+
'zip',
|
|
165
|
+
'__import__',
|
|
166
|
+
'apply',
|
|
167
|
+
'buffer',
|
|
168
|
+
'coerce',
|
|
169
|
+
'intern'
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
const values = ['self', 'True', 'False', 'None'];
|
|
173
|
+
language.push({pattern: /^\s*@\w+/m, type: 'decorator'});
|
|
174
|
+
language.push(values, {type: 'constant'});
|
|
175
|
+
language.push(keywords, {type: 'keyword'});
|
|
176
|
+
language.push(operators, {type: 'operator'});
|
|
177
|
+
language.push(builtinFunctions, {type: 'builtin'});
|
|
178
|
+
|
|
179
|
+
// ClassNames (CamelCase)
|
|
180
|
+
language.push(Rule.camelCaseType);
|
|
181
|
+
language.push(Rule.cStyleFunction);
|
|
182
|
+
|
|
183
|
+
language.push(Rule.perlStyleComment);
|
|
184
|
+
language.push({pattern: /(['\"]{3})([^\1])*?\1/m, type: 'comment'});
|
|
185
|
+
language.push(Rule.webLink);
|
|
186
|
+
|
|
187
|
+
// Strings
|
|
188
|
+
language.push(Rule.singleQuotedString);
|
|
189
|
+
language.push(Rule.doubleQuotedString);
|
|
190
|
+
language.push(Rule.stringEscape);
|
|
191
|
+
|
|
192
|
+
// Numbers
|
|
193
|
+
language.push(Rule.decimalNumber);
|
|
194
|
+
language.push(Rule.hexNumber);
|
|
195
|
+
|
|
196
|
+
language.processes['function'] = Rule.webLinkProcess(
|
|
197
|
+
'http://docs.python.org/search.html?q='
|
|
198
|
+
);
|
|
199
|
+
language.processes['type'] = Rule.webLinkProcess(
|
|
200
|
+
'http://docs.python.org/search.html?q='
|
|
201
|
+
);
|
|
202
|
+
language.processes['builtin'] = Rule.webLinkProcess(
|
|
203
|
+
'http://docs.python.org/search.html?q='
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
export default function register(syntax) {
|
|
207
|
+
syntax.register('python', language);
|
|
208
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
import {Match} from '../Match.js';
|
|
4
|
+
|
|
5
|
+
const language = new Language('ruby');
|
|
6
|
+
|
|
7
|
+
// Ruby-style function definitions and method calls (def foo, .bar)
|
|
8
|
+
// Method names can end with ? or !
|
|
9
|
+
const rubyStyleFunction = {
|
|
10
|
+
pattern: /(?:def\s+|\.)([a-z_][a-z0-9_]*[?!]?)/i,
|
|
11
|
+
matches: Rule.extractMatches({type: 'function'})
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// Emulate negative lookbehind to avoid matching ::symbol (only match :symbol not ::symbol)
|
|
15
|
+
// Symbols can also end with ? or !
|
|
16
|
+
const rubyStyleSymbol = {
|
|
17
|
+
pattern: /([:]?):\w+[?!]?/,
|
|
18
|
+
type: 'constant',
|
|
19
|
+
matches: function (/* syntax */ _syntax, match, expr) {
|
|
20
|
+
// If there is a preceding ':' captured, skip (handles '::symbol').
|
|
21
|
+
if (match[1] !== '') return [];
|
|
22
|
+
|
|
23
|
+
return [new Match(match.index, match[0].length, expr, match[0])];
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Keywords, operators, values and access modifiers
|
|
28
|
+
const keywords = [
|
|
29
|
+
'alias',
|
|
30
|
+
'and',
|
|
31
|
+
'begin',
|
|
32
|
+
'break',
|
|
33
|
+
'case',
|
|
34
|
+
'class',
|
|
35
|
+
'def',
|
|
36
|
+
'define_method',
|
|
37
|
+
'defined?',
|
|
38
|
+
'do',
|
|
39
|
+
'else',
|
|
40
|
+
'elsif',
|
|
41
|
+
'end',
|
|
42
|
+
'ensure',
|
|
43
|
+
'false',
|
|
44
|
+
'for',
|
|
45
|
+
'if',
|
|
46
|
+
'in',
|
|
47
|
+
'module',
|
|
48
|
+
'next',
|
|
49
|
+
'not',
|
|
50
|
+
'or',
|
|
51
|
+
'raise',
|
|
52
|
+
'redo',
|
|
53
|
+
'rescue',
|
|
54
|
+
'retry',
|
|
55
|
+
'return',
|
|
56
|
+
'then',
|
|
57
|
+
'throw',
|
|
58
|
+
'undef',
|
|
59
|
+
'unless',
|
|
60
|
+
'until',
|
|
61
|
+
'when',
|
|
62
|
+
'while',
|
|
63
|
+
'yield',
|
|
64
|
+
'block_given?'
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
const operators = ['+', '*', '/', '-', '&', '|', '~', '!', '%', '<', '=', '>', '...', '..'];
|
|
68
|
+
const values = ['self', 'super', 'true', 'false', 'nil'];
|
|
69
|
+
const access = ['private', 'protected', 'public'];
|
|
70
|
+
|
|
71
|
+
language.push(access, {type: 'access'});
|
|
72
|
+
language.push(values, {type: 'constant'});
|
|
73
|
+
|
|
74
|
+
// Percent-literals like %q{...}, %w{...}
|
|
75
|
+
language.push({
|
|
76
|
+
pattern: /(\%[\S])(\{[\s\S]*?\})/,
|
|
77
|
+
matches: Rule.extractMatches({type: 'function'}, {type: 'constant'})
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Backtick command strings
|
|
81
|
+
language.push({pattern: /`[^`]+`/, type: 'string'});
|
|
82
|
+
|
|
83
|
+
// Interpolation inside strings: #{ ... }
|
|
84
|
+
language.push({
|
|
85
|
+
pattern: /\#\{([^\}]*)\}/,
|
|
86
|
+
matches: Rule.extractMatches({language: 'ruby', only: ['string']})
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Regular expressions
|
|
90
|
+
language.push(Rule.rubyStyleRegularExpression);
|
|
91
|
+
|
|
92
|
+
// Instance/class/global variables
|
|
93
|
+
language.push({pattern: /(@+|\$)[\w]+/, type: 'variable'});
|
|
94
|
+
|
|
95
|
+
// Types (CamelCase constants)
|
|
96
|
+
language.push(Rule.camelCaseType);
|
|
97
|
+
|
|
98
|
+
// Core tokens
|
|
99
|
+
language.push(keywords, {type: 'keyword'});
|
|
100
|
+
language.push(operators, {type: 'operator'});
|
|
101
|
+
|
|
102
|
+
// Symbols
|
|
103
|
+
language.push(rubyStyleSymbol);
|
|
104
|
+
|
|
105
|
+
// Comments and links
|
|
106
|
+
language.push(Rule.perlStyleComment);
|
|
107
|
+
language.push(Rule.webLink);
|
|
108
|
+
|
|
109
|
+
// Strings
|
|
110
|
+
language.push(Rule.singleQuotedString);
|
|
111
|
+
language.push(Rule.doubleQuotedString);
|
|
112
|
+
language.push(Rule.stringEscape);
|
|
113
|
+
|
|
114
|
+
// Numbers
|
|
115
|
+
language.push(Rule.decimalNumber);
|
|
116
|
+
language.push(Rule.hexNumber);
|
|
117
|
+
|
|
118
|
+
// Functions (definitions and c-style function detection)
|
|
119
|
+
language.push(rubyStyleFunction);
|
|
120
|
+
language.push(Rule.cStyleFunction);
|
|
121
|
+
|
|
122
|
+
export default function register(syntax) {
|
|
123
|
+
syntax.register('ruby', language);
|
|
124
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('scala');
|
|
5
|
+
|
|
6
|
+
// Keywords
|
|
7
|
+
language.push(
|
|
8
|
+
[
|
|
9
|
+
'abstract',
|
|
10
|
+
'do',
|
|
11
|
+
'finally',
|
|
12
|
+
'import',
|
|
13
|
+
'object',
|
|
14
|
+
'return',
|
|
15
|
+
'trait',
|
|
16
|
+
'var',
|
|
17
|
+
'case',
|
|
18
|
+
'catch',
|
|
19
|
+
'class',
|
|
20
|
+
'else',
|
|
21
|
+
'extends',
|
|
22
|
+
'for',
|
|
23
|
+
'forSome',
|
|
24
|
+
'if',
|
|
25
|
+
'lazy',
|
|
26
|
+
'match',
|
|
27
|
+
'new',
|
|
28
|
+
'override',
|
|
29
|
+
'package',
|
|
30
|
+
'private',
|
|
31
|
+
'sealed',
|
|
32
|
+
'super',
|
|
33
|
+
'try',
|
|
34
|
+
'type',
|
|
35
|
+
'while',
|
|
36
|
+
'with',
|
|
37
|
+
'yield',
|
|
38
|
+
'def',
|
|
39
|
+
'final',
|
|
40
|
+
'implicit',
|
|
41
|
+
'protected',
|
|
42
|
+
'throw',
|
|
43
|
+
'val'
|
|
44
|
+
],
|
|
45
|
+
{type: 'keyword'}
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// Operators
|
|
49
|
+
language.push(['_', ':', '=', '=>', '<-', '<:', '<%', '>:', '#', '@'], {
|
|
50
|
+
type: 'operator'
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Constants
|
|
54
|
+
language.push(['this', 'null', 'true', 'false'], {type: 'constant'});
|
|
55
|
+
|
|
56
|
+
// Triple-quoted strings
|
|
57
|
+
language.push({pattern: /"""[\s\S]*?"""/, type: 'string'});
|
|
58
|
+
|
|
59
|
+
// Double-quoted strings
|
|
60
|
+
language.push(Rule.doubleQuotedString);
|
|
61
|
+
|
|
62
|
+
// Functions: `def name` or `.name`
|
|
63
|
+
language.push({
|
|
64
|
+
pattern: /(?:def\s+|\.)([a-z_][a-z0-9_]+)/i,
|
|
65
|
+
matches: Rule.extractMatches({type: 'function'})
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Types and function calls
|
|
69
|
+
language.push(Rule.camelCaseType);
|
|
70
|
+
language.push(Rule.cStyleFunction);
|
|
71
|
+
|
|
72
|
+
// Comments
|
|
73
|
+
language.push(Rule.cStyleComment);
|
|
74
|
+
language.push(Rule.cppStyleComment);
|
|
75
|
+
|
|
76
|
+
// Scala supports XML literals; derive XML rules
|
|
77
|
+
language.derives('xml');
|
|
78
|
+
|
|
79
|
+
export default function register(syntax) {
|
|
80
|
+
syntax.register('scala', language);
|
|
81
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('smalltalk');
|
|
5
|
+
|
|
6
|
+
const operators = ['[', ']', '|', ':=', '.'];
|
|
7
|
+
|
|
8
|
+
const values = ['self', 'super', 'true', 'false', 'nil'];
|
|
9
|
+
|
|
10
|
+
language.push(values, {type: 'constant'});
|
|
11
|
+
language.push(operators, {type: 'operator'});
|
|
12
|
+
|
|
13
|
+
// Objective-C style functions (method selectors ending with colon)
|
|
14
|
+
language.push({pattern: /\w+:/, type: 'function'});
|
|
15
|
+
|
|
16
|
+
// Camelcase Types
|
|
17
|
+
language.push(Rule.camelCaseType);
|
|
18
|
+
|
|
19
|
+
// Strings
|
|
20
|
+
language.push(Rule.singleQuotedString);
|
|
21
|
+
language.push(Rule.doubleQuotedString);
|
|
22
|
+
language.push(Rule.stringEscape);
|
|
23
|
+
|
|
24
|
+
// Numbers
|
|
25
|
+
language.push(Rule.decimalNumber);
|
|
26
|
+
language.push(Rule.hexNumber);
|
|
27
|
+
|
|
28
|
+
export default function register(syntax) {
|
|
29
|
+
syntax.register('smalltalk', language);
|
|
30
|
+
}
|