@kg-ui/kg-ui-plus 0.0.1 → 0.0.3
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.
- package/README.md +3 -3
- package/dist/es/KgCopilot/CopiContent/AnswerHead.vue.mjs +16 -0
- package/dist/es/KgCopilot/CopiContent/AnswerHead.vue2.mjs +4 -0
- package/dist/es/KgCopilot/CopiContent/UserHead.vue.mjs +26 -0
- package/dist/es/KgCopilot/CopiContent/UserHead.vue2.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/components/NewTheme.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/components/NewTheme.vue2.mjs +49 -0
- package/dist/es/KgCopilot/CopiFooter/components/NewTheme.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPlugin.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPlugin.vue2.mjs +94 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPlugin.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SpeechControl.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SpeechControl.vue2.mjs +33 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SpeechControl.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/Upload.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/Upload.vue2.mjs +140 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/Upload.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue2.mjs +131 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/index.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/index.vue2.mjs +21 -0
- package/dist/es/KgCopilot/CopiFooter/index.vue3.mjs +4 -0
- package/dist/es/KgCopilot/dialogue/index.vue.mjs +7 -0
- package/dist/es/KgCopilot/dialogue/index.vue2.mjs +131 -0
- package/dist/es/KgCopilot/dialogue/index.vue3.mjs +4 -0
- package/dist/es/KgCopilot/dialogue/mdInCode.mjs +56 -0
- package/dist/es/KgCopilot/dialogue/readMd.vue.mjs +7 -0
- package/dist/es/KgCopilot/dialogue/readMd.vue2.mjs +87 -0
- package/dist/es/KgCopilot/dialogue/readMd.vue3.mjs +4 -0
- package/dist/es/KgCopilot/index.vue.mjs +7 -0
- package/dist/es/KgCopilot/index.vue2.mjs +49 -0
- package/dist/es/KgCopilot/index.vue3.mjs +4 -0
- package/dist/es/_virtual/___vite-browser-external.mjs +6 -0
- package/dist/es/_virtual/__vite-browser-external.mjs +4 -0
- package/dist/es/_virtual/_commonjsHelpers.mjs +34 -0
- package/dist/es/_virtual/_plugin-vue_export-helper.mjs +10 -0
- package/dist/es/_virtual/index.mjs +13 -0
- package/dist/es/api/project.mjs +51 -0
- package/dist/es/directives/heighlight/index.mjs +69 -0
- package/dist/es/directives/index.mjs +4 -0
- package/dist/es/home/LFilter/FilterArea.vue.mjs +7 -0
- package/dist/es/home/LFilter/FilterArea.vue2.mjs +507 -0
- package/dist/es/home/LFilter/FilterArea.vue3.mjs +4 -0
- package/dist/es/home/LFilter/FilterHead.vue.mjs +129 -0
- package/dist/es/home/LFilter/FilterHead.vue2.mjs +4 -0
- package/dist/es/home/LFilter/FilterItem.vue.mjs +7 -0
- package/dist/es/home/LFilter/FilterItem.vue2.mjs +114 -0
- package/dist/es/home/LFilter/FilterItem.vue3.mjs +4 -0
- package/dist/es/home/LFilter/FilterItemIcon.vue.mjs +7 -0
- package/dist/es/home/LFilter/FilterItemIcon.vue2.mjs +171 -0
- package/dist/es/home/LFilter/FilterItemIcon.vue3.mjs +4 -0
- package/dist/es/home/LFilter/index.vue.mjs +17 -0
- package/dist/es/home/LFilter/index.vue2.mjs +4 -0
- package/dist/es/home/LProject/index.vue.mjs +7 -0
- package/dist/es/home/LProject/index.vue2.mjs +70 -0
- package/dist/es/home/LProject/index.vue3.mjs +4 -0
- package/dist/es/home/index.vue.mjs +7 -0
- package/dist/es/home/index.vue2.mjs +80 -0
- package/dist/es/home/index.vue3.mjs +4 -0
- package/dist/es/index.mjs +26 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/check.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/circle-plus.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/close.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/microphone.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/paperclip.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/promotion.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/upload.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/copy-simple.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/speaker-high-light.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/thumbs-down-thin.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/thumbs-up-thin.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/warning-bold.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/add-line.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/arrow-down-s-line.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/arrow-up-s-line.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/check-fill.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/download-line.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/more-2-fill.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@pureadmin_utils@1.8.5_vue@3.2.45/node_modules/@pureadmin/utils/dist/index.mjs +70 -0
- package/dist/es/node_modules/.pnpm/call-bind@1.0.7/node_modules/call-bind/callBound.mjs +16 -0
- package/dist/es/node_modules/.pnpm/call-bind@1.0.7/node_modules/call-bind/index.mjs +36 -0
- package/dist/es/node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.mjs +48 -0
- package/dist/es/node_modules/.pnpm/dompurify@3.0.10/node_modules/dompurify/dist/purify.es.mjs +949 -0
- package/dist/es/node_modules/.pnpm/es-define-property@1.0.0/node_modules/es-define-property/index.mjs +22 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.mjs +4 -0
- package/dist/es/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.mjs +72 -0
- package/dist/es/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.mjs +6 -0
- package/dist/es/node_modules/.pnpm/get-intrinsic@1.2.4/node_modules/get-intrinsic/index.mjs +320 -0
- package/dist/es/node_modules/.pnpm/gopd@1.0.1/node_modules/gopd/index.mjs +14 -0
- package/dist/es/node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.mjs +19 -0
- package/dist/es/node_modules/.pnpm/has-proto@1.0.3/node_modules/has-proto/index.mjs +11 -0
- package/dist/es/node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/index.mjs +21 -0
- package/dist/es/node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/shams.mjs +48 -0
- package/dist/es/node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.mjs +8 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/core.mjs +5 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/apache.mjs +91 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/bash.mjs +377 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/basic.mjs +221 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/c.mjs +280 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/css.mjs +732 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/dart.mjs +247 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/django.mjs +47 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/dns.mjs +71 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/dos.mjs +160 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/dust.mjs +38 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/erlang.mjs +176 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/go.mjs +135 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/http.mjs +89 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/java.mjs +254 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/javascript.mjs +698 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/json.mjs +40 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/markdown.mjs +227 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/nginx.mjs +144 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/php.mjs +589 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/python.mjs +414 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/ruby.mjs +414 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/stylus.mjs +766 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/swift.mjs +832 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/typescript.mjs +788 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/xml.mjs +227 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/lib/core.mjs +1580 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/styles/paraiso-light.css.mjs +4 -0
- package/dist/es/node_modules/.pnpm/marked@12.0.1/node_modules/marked/lib/marked.esm.mjs +2045 -0
- package/dist/es/node_modules/.pnpm/object-inspect@1.13.1/node_modules/object-inspect/index.mjs +514 -0
- package/dist/es/node_modules/.pnpm/pinyin-match@1.2.4/node_modules/pinyin-match/es/main.mjs +124 -0
- package/dist/es/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/formats.mjs +22 -0
- package/dist/es/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/index.mjs +14 -0
- package/dist/es/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/parse.mjs +199 -0
- package/dist/es/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/stringify.mjs +262 -0
- package/dist/es/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/utils.mjs +196 -0
- package/dist/es/node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.mjs +54 -0
- package/dist/es/node_modules/.pnpm/side-channel@1.0.6/node_modules/side-channel/index.mjs +115 -0
- package/dist/es/store/index.mjs +8 -0
- package/dist/es/store/modules/copilot.mjs +111 -0
- package/dist/es/store/modules/filters.mjs +346 -0
- package/dist/es/store/modules/types.mjs +19 -0
- package/dist/es/style/index.scss.mjs +4 -0
- package/dist/es/style/tailwind.css.mjs +4 -0
- package/dist/es/style.css +1 -0
- package/dist/es/utils/home.mjs +129 -0
- package/dist/es/utils/http/index.mjs +90 -0
- package/dist/es/utils/message.mjs +42 -0
- package/package.json +23 -32
@@ -0,0 +1,414 @@
|
|
1
|
+
function ruby(hljs) {
|
2
|
+
const regex = hljs.regex;
|
3
|
+
const RUBY_METHOD_RE = "([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)";
|
4
|
+
const CLASS_NAME_RE = regex.either(
|
5
|
+
/\b([A-Z]+[a-z0-9]+)+/,
|
6
|
+
// ends in caps
|
7
|
+
/\b([A-Z]+[a-z0-9]+)+[A-Z]+/
|
8
|
+
);
|
9
|
+
const CLASS_NAME_WITH_NAMESPACE_RE = regex.concat(CLASS_NAME_RE, /(::\w+)*/);
|
10
|
+
const PSEUDO_KWS = [
|
11
|
+
"include",
|
12
|
+
"extend",
|
13
|
+
"prepend",
|
14
|
+
"public",
|
15
|
+
"private",
|
16
|
+
"protected",
|
17
|
+
"raise",
|
18
|
+
"throw"
|
19
|
+
];
|
20
|
+
const RUBY_KEYWORDS = {
|
21
|
+
"variable.constant": [
|
22
|
+
"__FILE__",
|
23
|
+
"__LINE__",
|
24
|
+
"__ENCODING__"
|
25
|
+
],
|
26
|
+
"variable.language": [
|
27
|
+
"self",
|
28
|
+
"super"
|
29
|
+
],
|
30
|
+
keyword: [
|
31
|
+
"alias",
|
32
|
+
"and",
|
33
|
+
"begin",
|
34
|
+
"BEGIN",
|
35
|
+
"break",
|
36
|
+
"case",
|
37
|
+
"class",
|
38
|
+
"defined",
|
39
|
+
"do",
|
40
|
+
"else",
|
41
|
+
"elsif",
|
42
|
+
"end",
|
43
|
+
"END",
|
44
|
+
"ensure",
|
45
|
+
"for",
|
46
|
+
"if",
|
47
|
+
"in",
|
48
|
+
"module",
|
49
|
+
"next",
|
50
|
+
"not",
|
51
|
+
"or",
|
52
|
+
"redo",
|
53
|
+
"require",
|
54
|
+
"rescue",
|
55
|
+
"retry",
|
56
|
+
"return",
|
57
|
+
"then",
|
58
|
+
"undef",
|
59
|
+
"unless",
|
60
|
+
"until",
|
61
|
+
"when",
|
62
|
+
"while",
|
63
|
+
"yield",
|
64
|
+
...PSEUDO_KWS
|
65
|
+
],
|
66
|
+
built_in: [
|
67
|
+
"proc",
|
68
|
+
"lambda",
|
69
|
+
"attr_accessor",
|
70
|
+
"attr_reader",
|
71
|
+
"attr_writer",
|
72
|
+
"define_method",
|
73
|
+
"private_constant",
|
74
|
+
"module_function"
|
75
|
+
],
|
76
|
+
literal: [
|
77
|
+
"true",
|
78
|
+
"false",
|
79
|
+
"nil"
|
80
|
+
]
|
81
|
+
};
|
82
|
+
const YARDOCTAG = {
|
83
|
+
className: "doctag",
|
84
|
+
begin: "@[A-Za-z]+"
|
85
|
+
};
|
86
|
+
const IRB_OBJECT = {
|
87
|
+
begin: "#<",
|
88
|
+
end: ">"
|
89
|
+
};
|
90
|
+
const COMMENT_MODES = [
|
91
|
+
hljs.COMMENT(
|
92
|
+
"#",
|
93
|
+
"$",
|
94
|
+
{ contains: [YARDOCTAG] }
|
95
|
+
),
|
96
|
+
hljs.COMMENT(
|
97
|
+
"^=begin",
|
98
|
+
"^=end",
|
99
|
+
{
|
100
|
+
contains: [YARDOCTAG],
|
101
|
+
relevance: 10
|
102
|
+
}
|
103
|
+
),
|
104
|
+
hljs.COMMENT("^__END__", hljs.MATCH_NOTHING_RE)
|
105
|
+
];
|
106
|
+
const SUBST = {
|
107
|
+
className: "subst",
|
108
|
+
begin: /#\{/,
|
109
|
+
end: /\}/,
|
110
|
+
keywords: RUBY_KEYWORDS
|
111
|
+
};
|
112
|
+
const STRING = {
|
113
|
+
className: "string",
|
114
|
+
contains: [
|
115
|
+
hljs.BACKSLASH_ESCAPE,
|
116
|
+
SUBST
|
117
|
+
],
|
118
|
+
variants: [
|
119
|
+
{
|
120
|
+
begin: /'/,
|
121
|
+
end: /'/
|
122
|
+
},
|
123
|
+
{
|
124
|
+
begin: /"/,
|
125
|
+
end: /"/
|
126
|
+
},
|
127
|
+
{
|
128
|
+
begin: /`/,
|
129
|
+
end: /`/
|
130
|
+
},
|
131
|
+
{
|
132
|
+
begin: /%[qQwWx]?\(/,
|
133
|
+
end: /\)/
|
134
|
+
},
|
135
|
+
{
|
136
|
+
begin: /%[qQwWx]?\[/,
|
137
|
+
end: /\]/
|
138
|
+
},
|
139
|
+
{
|
140
|
+
begin: /%[qQwWx]?\{/,
|
141
|
+
end: /\}/
|
142
|
+
},
|
143
|
+
{
|
144
|
+
begin: /%[qQwWx]?</,
|
145
|
+
end: />/
|
146
|
+
},
|
147
|
+
{
|
148
|
+
begin: /%[qQwWx]?\//,
|
149
|
+
end: /\//
|
150
|
+
},
|
151
|
+
{
|
152
|
+
begin: /%[qQwWx]?%/,
|
153
|
+
end: /%/
|
154
|
+
},
|
155
|
+
{
|
156
|
+
begin: /%[qQwWx]?-/,
|
157
|
+
end: /-/
|
158
|
+
},
|
159
|
+
{
|
160
|
+
begin: /%[qQwWx]?\|/,
|
161
|
+
end: /\|/
|
162
|
+
},
|
163
|
+
// in the following expressions, \B in the beginning suppresses recognition of ?-sequences
|
164
|
+
// where ? is the last character of a preceding identifier, as in: `func?4`
|
165
|
+
{ begin: /\B\?(\\\d{1,3})/ },
|
166
|
+
{ begin: /\B\?(\\x[A-Fa-f0-9]{1,2})/ },
|
167
|
+
{ begin: /\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/ },
|
168
|
+
{ begin: /\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/ },
|
169
|
+
{ begin: /\B\?\\(c|C-)[\x20-\x7e]/ },
|
170
|
+
{ begin: /\B\?\\?\S/ },
|
171
|
+
// heredocs
|
172
|
+
{
|
173
|
+
// this guard makes sure that we have an entire heredoc and not a false
|
174
|
+
// positive (auto-detect, etc.)
|
175
|
+
begin: regex.concat(
|
176
|
+
/<<[-~]?'?/,
|
177
|
+
regex.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)
|
178
|
+
),
|
179
|
+
contains: [
|
180
|
+
hljs.END_SAME_AS_BEGIN({
|
181
|
+
begin: /(\w+)/,
|
182
|
+
end: /(\w+)/,
|
183
|
+
contains: [
|
184
|
+
hljs.BACKSLASH_ESCAPE,
|
185
|
+
SUBST
|
186
|
+
]
|
187
|
+
})
|
188
|
+
]
|
189
|
+
}
|
190
|
+
]
|
191
|
+
};
|
192
|
+
const decimal = "[1-9](_?[0-9])*|0";
|
193
|
+
const digits = "[0-9](_?[0-9])*";
|
194
|
+
const NUMBER = {
|
195
|
+
className: "number",
|
196
|
+
relevance: 0,
|
197
|
+
variants: [
|
198
|
+
// decimal integer/float, optionally exponential or rational, optionally imaginary
|
199
|
+
{ begin: `\\b(${decimal})(\\.(${digits}))?([eE][+-]?(${digits})|r)?i?\\b` },
|
200
|
+
// explicit decimal/binary/octal/hexadecimal integer,
|
201
|
+
// optionally rational and/or imaginary
|
202
|
+
{ begin: "\\b0[dD][0-9](_?[0-9])*r?i?\\b" },
|
203
|
+
{ begin: "\\b0[bB][0-1](_?[0-1])*r?i?\\b" },
|
204
|
+
{ begin: "\\b0[oO][0-7](_?[0-7])*r?i?\\b" },
|
205
|
+
{ begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b" },
|
206
|
+
// 0-prefixed implicit octal integer, optionally rational and/or imaginary
|
207
|
+
{ begin: "\\b0(_?[0-7])+r?i?\\b" }
|
208
|
+
]
|
209
|
+
};
|
210
|
+
const PARAMS = {
|
211
|
+
variants: [
|
212
|
+
{
|
213
|
+
match: /\(\)/
|
214
|
+
},
|
215
|
+
{
|
216
|
+
className: "params",
|
217
|
+
begin: /\(/,
|
218
|
+
end: /(?=\))/,
|
219
|
+
excludeBegin: true,
|
220
|
+
endsParent: true,
|
221
|
+
keywords: RUBY_KEYWORDS
|
222
|
+
}
|
223
|
+
]
|
224
|
+
};
|
225
|
+
const INCLUDE_EXTEND = {
|
226
|
+
match: [
|
227
|
+
/(include|extend)\s+/,
|
228
|
+
CLASS_NAME_WITH_NAMESPACE_RE
|
229
|
+
],
|
230
|
+
scope: {
|
231
|
+
2: "title.class"
|
232
|
+
},
|
233
|
+
keywords: RUBY_KEYWORDS
|
234
|
+
};
|
235
|
+
const CLASS_DEFINITION = {
|
236
|
+
variants: [
|
237
|
+
{
|
238
|
+
match: [
|
239
|
+
/class\s+/,
|
240
|
+
CLASS_NAME_WITH_NAMESPACE_RE,
|
241
|
+
/\s+<\s+/,
|
242
|
+
CLASS_NAME_WITH_NAMESPACE_RE
|
243
|
+
]
|
244
|
+
},
|
245
|
+
{
|
246
|
+
match: [
|
247
|
+
/\b(class|module)\s+/,
|
248
|
+
CLASS_NAME_WITH_NAMESPACE_RE
|
249
|
+
]
|
250
|
+
}
|
251
|
+
],
|
252
|
+
scope: {
|
253
|
+
2: "title.class",
|
254
|
+
4: "title.class.inherited"
|
255
|
+
},
|
256
|
+
keywords: RUBY_KEYWORDS
|
257
|
+
};
|
258
|
+
const UPPER_CASE_CONSTANT = {
|
259
|
+
relevance: 0,
|
260
|
+
match: /\b[A-Z][A-Z_0-9]+\b/,
|
261
|
+
className: "variable.constant"
|
262
|
+
};
|
263
|
+
const METHOD_DEFINITION = {
|
264
|
+
match: [
|
265
|
+
/def/,
|
266
|
+
/\s+/,
|
267
|
+
RUBY_METHOD_RE
|
268
|
+
],
|
269
|
+
scope: {
|
270
|
+
1: "keyword",
|
271
|
+
3: "title.function"
|
272
|
+
},
|
273
|
+
contains: [
|
274
|
+
PARAMS
|
275
|
+
]
|
276
|
+
};
|
277
|
+
const OBJECT_CREATION = {
|
278
|
+
relevance: 0,
|
279
|
+
match: [
|
280
|
+
CLASS_NAME_WITH_NAMESPACE_RE,
|
281
|
+
/\.new[. (]/
|
282
|
+
],
|
283
|
+
scope: {
|
284
|
+
1: "title.class"
|
285
|
+
}
|
286
|
+
};
|
287
|
+
const CLASS_REFERENCE = {
|
288
|
+
relevance: 0,
|
289
|
+
match: CLASS_NAME_RE,
|
290
|
+
scope: "title.class"
|
291
|
+
};
|
292
|
+
const RUBY_DEFAULT_CONTAINS = [
|
293
|
+
STRING,
|
294
|
+
CLASS_DEFINITION,
|
295
|
+
INCLUDE_EXTEND,
|
296
|
+
OBJECT_CREATION,
|
297
|
+
UPPER_CASE_CONSTANT,
|
298
|
+
CLASS_REFERENCE,
|
299
|
+
METHOD_DEFINITION,
|
300
|
+
{
|
301
|
+
// swallow namespace qualifiers before symbols
|
302
|
+
begin: hljs.IDENT_RE + "::"
|
303
|
+
},
|
304
|
+
{
|
305
|
+
className: "symbol",
|
306
|
+
begin: hljs.UNDERSCORE_IDENT_RE + "(!|\\?)?:",
|
307
|
+
relevance: 0
|
308
|
+
},
|
309
|
+
{
|
310
|
+
className: "symbol",
|
311
|
+
begin: ":(?!\\s)",
|
312
|
+
contains: [
|
313
|
+
STRING,
|
314
|
+
{ begin: RUBY_METHOD_RE }
|
315
|
+
],
|
316
|
+
relevance: 0
|
317
|
+
},
|
318
|
+
NUMBER,
|
319
|
+
{
|
320
|
+
// negative-look forward attempts to prevent false matches like:
|
321
|
+
// @ident@ or $ident$ that might indicate this is not ruby at all
|
322
|
+
className: "variable",
|
323
|
+
begin: `(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])`
|
324
|
+
},
|
325
|
+
{
|
326
|
+
className: "params",
|
327
|
+
begin: /\|/,
|
328
|
+
end: /\|/,
|
329
|
+
excludeBegin: true,
|
330
|
+
excludeEnd: true,
|
331
|
+
relevance: 0,
|
332
|
+
// this could be a lot of things (in other languages) other than params
|
333
|
+
keywords: RUBY_KEYWORDS
|
334
|
+
},
|
335
|
+
{
|
336
|
+
// regexp container
|
337
|
+
begin: "(" + hljs.RE_STARTERS_RE + "|unless)\\s*",
|
338
|
+
keywords: "unless",
|
339
|
+
contains: [
|
340
|
+
{
|
341
|
+
className: "regexp",
|
342
|
+
contains: [
|
343
|
+
hljs.BACKSLASH_ESCAPE,
|
344
|
+
SUBST
|
345
|
+
],
|
346
|
+
illegal: /\n/,
|
347
|
+
variants: [
|
348
|
+
{
|
349
|
+
begin: "/",
|
350
|
+
end: "/[a-z]*"
|
351
|
+
},
|
352
|
+
{
|
353
|
+
begin: /%r\{/,
|
354
|
+
end: /\}[a-z]*/
|
355
|
+
},
|
356
|
+
{
|
357
|
+
begin: "%r\\(",
|
358
|
+
end: "\\)[a-z]*"
|
359
|
+
},
|
360
|
+
{
|
361
|
+
begin: "%r!",
|
362
|
+
end: "![a-z]*"
|
363
|
+
},
|
364
|
+
{
|
365
|
+
begin: "%r\\[",
|
366
|
+
end: "\\][a-z]*"
|
367
|
+
}
|
368
|
+
]
|
369
|
+
}
|
370
|
+
].concat(IRB_OBJECT, COMMENT_MODES),
|
371
|
+
relevance: 0
|
372
|
+
}
|
373
|
+
].concat(IRB_OBJECT, COMMENT_MODES);
|
374
|
+
SUBST.contains = RUBY_DEFAULT_CONTAINS;
|
375
|
+
PARAMS.contains = RUBY_DEFAULT_CONTAINS;
|
376
|
+
const SIMPLE_PROMPT = "[>?]>";
|
377
|
+
const DEFAULT_PROMPT = "[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]";
|
378
|
+
const RVM_PROMPT = "(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>";
|
379
|
+
const IRB_DEFAULT = [
|
380
|
+
{
|
381
|
+
begin: /^\s*=>/,
|
382
|
+
starts: {
|
383
|
+
end: "$",
|
384
|
+
contains: RUBY_DEFAULT_CONTAINS
|
385
|
+
}
|
386
|
+
},
|
387
|
+
{
|
388
|
+
className: "meta.prompt",
|
389
|
+
begin: "^(" + SIMPLE_PROMPT + "|" + DEFAULT_PROMPT + "|" + RVM_PROMPT + ")(?=[ ])",
|
390
|
+
starts: {
|
391
|
+
end: "$",
|
392
|
+
keywords: RUBY_KEYWORDS,
|
393
|
+
contains: RUBY_DEFAULT_CONTAINS
|
394
|
+
}
|
395
|
+
}
|
396
|
+
];
|
397
|
+
COMMENT_MODES.unshift(IRB_OBJECT);
|
398
|
+
return {
|
399
|
+
name: "Ruby",
|
400
|
+
aliases: [
|
401
|
+
"rb",
|
402
|
+
"gemspec",
|
403
|
+
"podspec",
|
404
|
+
"thor",
|
405
|
+
"irb"
|
406
|
+
],
|
407
|
+
keywords: RUBY_KEYWORDS,
|
408
|
+
illegal: /\/\*/,
|
409
|
+
contains: [hljs.SHEBANG({ binary: "ruby" })].concat(IRB_DEFAULT).concat(COMMENT_MODES).concat(RUBY_DEFAULT_CONTAINS)
|
410
|
+
};
|
411
|
+
}
|
412
|
+
export {
|
413
|
+
ruby as default
|
414
|
+
};
|