1
|
ace.define("ace/mode/perl6_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
2
|
"use strict";
|
3
|
|
4
|
var oop = require("../lib/oop");
|
5
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
6
|
|
7
|
var Perl6HighlightRules = function() {
|
8
|
|
9
|
var keywords = (
|
10
|
"my|our|class|role|grammar|is|does|sub|method|submethod|try|" +
|
11
|
"default|when|if|elsif|else|unless|with|orwith|without|for|given|proceed|" +
|
12
|
"succeed|loop|while|until|repeat|module|use|need|import|require|unit|" +
|
13
|
"constant|enum|multi|return|has|token|rule|make|made|proto|state|augment|" +
|
14
|
"but|anon|supersede|let|subset|gather|returns|return-rw|temp|" +
|
15
|
"BEGIN|CHECK|INIT|END|CLOSE|ENTER|LEAVE|KEEP|UNDO|PRE|POST|FIRST|NEXT|LAST|CATCH|CONTROL|QUIT|DOC"
|
16
|
);
|
17
|
|
18
|
var types = (
|
19
|
"Any|Array|Associative|AST|atomicint|Attribute|Backtrace|Backtrace::Frame|" +
|
20
|
"Bag|Baggy|BagHash|Blob|Block|Bool|Buf|Callable|CallFrame|Cancellation|" +
|
21
|
"Capture|Channel|Code|compiler|Complex|ComplexStr|Cool|CurrentThreadScheduler|" +
|
22
|
"Cursor|Date|Dateish|DateTime|Distro|Duration|Encoding|Exception|Failure|"+
|
23
|
"FatRat|Grammar|Hash|HyperWhatever|Instant|Int|IntStr|IO|IO::ArgFiles|"+
|
24
|
"IO::CatHandle|IO::Handle|IO::Notification|IO::Path|IO::Path::Cygwin|"+
|
25
|
"IO::Path::QNX|IO::Path::Unix|IO::Path::Win32|IO::Pipe|IO::Socket|"+
|
26
|
"IO::Socket::Async|IO::Socket::INET|IO::Spec|IO::Spec::Cygwin|IO::Spec::QNX|"+
|
27
|
"IO::Spec::Unix|IO::Spec::Win32|IO::Special|Iterable|Iterator|Junction|Kernel|"+
|
28
|
"Label|List|Lock|Lock::Async|Macro|Map|Match|Metamodel::AttributeContainer|"+
|
29
|
"Metamodel::C3MRO|Metamodel::ClassHOW|Metamodel::EnumHOW|Metamodel::Finalization|"+
|
30
|
"Metamodel::MethodContainer|Metamodel::MROBasedMethodDispatch|Metamodel::MultipleInheritance|"+
|
31
|
"Metamodel::Naming|Metamodel::Primitives|Metamodel::PrivateMethodContainer|"+
|
32
|
"Metamodel::RoleContainer|Metamodel::Trusting|Method|Mix|MixHash|Mixy|Mu|"+
|
33
|
"NFC|NFD|NFKC|NFKD|Nil|Num|Numeric|NumStr|ObjAt|Order|Pair|Parameter|Perl|"+
|
34
|
"Pod::Block|Pod::Block::Code|Pod::Block::Comment|Pod::Block::Declarator|"+
|
35
|
"Pod::Block::Named|Pod::Block::Para|Pod::Block::Table|Pod::Heading|Pod::Item|"+
|
36
|
"Positional|PositionalBindFailover|Proc|Proc::Async|Promise|Proxy|PseudoStash|"+
|
37
|
"QuantHash|Range|Rat|Rational|RatStr|Real|Regex|Routine|Scalar|Scheduler|"+
|
38
|
"Semaphore|Seq|Set|SetHash|Setty|Signature|Slip|Stash|Str|StrDistance|Stringy|"+
|
39
|
"Sub|Submethod|Supplier|Supplier::Preserving|Supply|Systemic|Tap|Telemetry|"+
|
40
|
"Telemetry::Instrument::Thread|Telemetry::Instrument::Usage|Telemetry::Period|"+
|
41
|
"Telemetry::Sampler|Thread|ThreadPoolScheduler|UInt|Uni|utf8|Variable|Version|"+
|
42
|
"VM|Whatever|WhateverCode|WrapHandle|int|uint|num|str|"+
|
43
|
"int8|int16|int32|int64|uint8|uint16|uint32|uint64|long|longlong|num32|num64|size_t|bool|CArray|Pointer|"+
|
44
|
"Backtrace|Backtrace::Frame|Exception|Failure|X::AdHoc|X::Anon::Augment|X::Anon::Multi|"+
|
45
|
"X::Assignment::RO|X::Attribute::NoPackage|X::Attribute::Package|X::Attribute::Undeclared|"+
|
46
|
"X::Augment::NoSuchType|X::Bind|X::Bind::NativeType|X::Bind::Slice|X::Caller::NotDynamic|"+
|
47
|
"X::Channel::ReceiveOnClosed|X::Channel::SendOnClosed|X::Comp|X::Composition::NotComposable|"+
|
48
|
"X::Constructor::Positional|X::ControlFlow|X::ControlFlow::Return|X::DateTime::TimezoneClash|"+
|
49
|
"X::Declaration::Scope|X::Declaration::Scope::Multi|X::Does::TypeObject|X::Eval::NoSuchLang|"+
|
50
|
"X::Export::NameClash|X::IO|X::IO::Chdir|X::IO::Chmod|X::IO::Copy|X::IO::Cwd|X::IO::Dir|"+
|
51
|
"X::IO::DoesNotExist|X::IO::Link|X::IO::Mkdir|X::IO::Move|X::IO::Rename|X::IO::Rmdir|X::IO::Symlink|"+
|
52
|
"X::IO::Unlink|X::Inheritance::NotComposed|X::Inheritance::Unsupported|X::Method::InvalidQualifier|"+
|
53
|
"X::Method::NotFound|X::Method::Private::Permission|X::Method::Private::Unqualified|"+
|
54
|
"X::Mixin::NotComposable|X::NYI|X::NoDispatcher|X::Numeric::Real|X::OS|X::Obsolete|X::OutOfRange|"+
|
55
|
"X::Package::Stubbed|X::Parameter::Default|X::Parameter::MultipleTypeConstraints|"+
|
56
|
"X::Parameter::Placeholder|X::Parameter::Twigil|X::Parameter::WrongOrder|X::Phaser::Multiple|"+
|
57
|
"X::Phaser::PrePost|X::Placeholder::Block|X::Placeholder::Mainline|X::Pod|X::Proc::Async|"+
|
58
|
"X::Proc::Async::AlreadyStarted|X::Proc::Async::CharsOrBytes|X::Proc::Async::MustBeStarted|"+
|
59
|
"X::Proc::Async::OpenForWriting|X::Proc::Async::TapBeforeSpawn|X::Proc::Unsuccessful|"+
|
60
|
"X::Promise::CauseOnlyValidOnBroken|X::Promise::Vowed|X::Redeclaration|X::Role::Initialization|"+
|
61
|
"X::Seq::Consumed|X::Sequence::Deduction|X::Signature::NameClash|X::Signature::Placeholder|"+
|
62
|
"X::Str::Numeric|X::StubCode|X::Syntax|X::Syntax::Augment::WithoutMonkeyTyping|"+
|
63
|
"X::Syntax::Comment::Embedded|X::Syntax::Confused|X::Syntax::InfixInTermPosition|"+
|
64
|
"X::Syntax::Malformed|X::Syntax::Missing|X::Syntax::NegatedPair|X::Syntax::NoSelf|"+
|
65
|
"X::Syntax::Number::RadixOutOfRange|X::Syntax::P5|X::Syntax::Regex::Adverb|"+
|
66
|
"X::Syntax::Regex::SolitaryQuantifier|X::Syntax::Reserved|X::Syntax::Self::WithoutObject|"+
|
67
|
"X::Syntax::Signature::InvocantMarker|X::Syntax::Term::MissingInitializer|X::Syntax::UnlessElse|"+
|
68
|
"X::Syntax::Variable::Match|X::Syntax::Variable::Numeric|X::Syntax::Variable::Twigil|X::Temporal|"+
|
69
|
"X::Temporal::InvalidFormat|X::TypeCheck|X::TypeCheck::Assignment|X::TypeCheck::Binding|"+
|
70
|
"X::TypeCheck::Return|X::TypeCheck::Splice|X::Undeclared"
|
71
|
);
|
72
|
|
73
|
var builtinFunctions = (
|
74
|
"abs|abs2rel|absolute|accept|ACCEPTS|accessed|acos|acosec|acosech|acosh|"+
|
75
|
"acotan|acotanh|acquire|act|action|actions|add|add_attribute|add_enum_value|"+
|
76
|
"add_fallback|add_method|add_parent|add_private_method|add_role|add_trustee|"+
|
77
|
"adverb|after|all|allocate|allof|allowed|alternative-names|annotations|antipair|"+
|
78
|
"antipairs|any|anyof|app_lifetime|append|arch|archname|args|arity|asec|asech|"+
|
79
|
"asin|asinh|ASSIGN-KEY|ASSIGN-POS|assuming|ast|at|atan|atan2|atanh|AT-KEY|"+
|
80
|
"atomic-assign|atomic-dec-fetch|atomic-fetch|atomic-fetch-add|atomic-fetch-dec|"+
|
81
|
"atomic-fetch-inc|atomic-fetch-sub|atomic-inc-fetch|AT-POS|attributes|auth|await|"+
|
82
|
"backtrace|Bag|BagHash|base|basename|base-repeating|batch|BIND-KEY|BIND-POS|"+
|
83
|
"bind-stderr|bind-stdin|bind-stdout|bind-udp|bits|bless|block|bool-only|"+
|
84
|
"bounds|break|Bridge|broken|BUILD|build-date|bytes|cache|callframe|calling-package|"+
|
85
|
"CALL-ME|callsame|callwith|can|cancel|candidates|cando|canonpath|caps|caption|"+
|
86
|
"Capture|cas|catdir|categorize|categorize-list|catfile|catpath|cause|ceiling|"+
|
87
|
"cglobal|changed|Channel|chars|chdir|child|child-name|child-typename|chmod|chomp|"+
|
88
|
"chop|chr|chrs|chunks|cis|classify|classify-list|cleanup|clone|close|closed|"+
|
89
|
"close-stdin|code|codes|collate|column|comb|combinations|command|comment|"+
|
90
|
"compiler|Complex|compose|compose_type|composer|condition|config|configure_destroy|"+
|
91
|
"configure_type_checking|conj|connect|constraints|construct|contains|contents|copy|"+
|
92
|
"cos|cosec|cosech|cosh|cotan|cotanh|count|count-only|cpu-cores|cpu-usage|CREATE|"+
|
93
|
"create_type|cross|cue|curdir|curupdir|d|Date|DateTime|day|daycount|day-of-month|"+
|
94
|
"day-of-week|day-of-year|days-in-month|declaration|decode|decoder|deepmap|"+
|
95
|
"defined|DEFINITE|delayed|DELETE-KEY|DELETE-POS|denominator|desc|DESTROY|destroyers|"+
|
96
|
"devnull|did-you-mean|die|dir|dirname|dir-sep|DISTROnames|do|done|duckmap|dynamic|"+
|
97
|
"e|eager|earlier|elems|emit|enclosing|encode|encoder|encoding|end|ends-with|enum_from_value|"+
|
98
|
"enum_value_list|enum_values|enums|eof|EVAL|EVALFILE|exception|excludes-max|excludes-min|"+
|
99
|
"EXISTS-KEY|EXISTS-POS|exit|exitcode|exp|expected|explicitly-manage|expmod|extension|f|"+
|
100
|
"fail|fc|feature|file|filename|find_method|find_method_qualified|finish|first|flat|flatmap|"+
|
101
|
"flip|floor|flush|fmt|format|formatter|freeze|from|from-list|from-loop|from-posix|full|"+
|
102
|
"full-barrier|get|get_value|getc|gist|got|grab|grabpairs|grep|handle|handled|handles|"+
|
103
|
"hardware|has_accessor|head|headers|hh-mm-ss|hidden|hides|hour|how|hyper|id|illegal|"+
|
104
|
"im|in|indent|index|indices|indir|infinite|infix|install_method_cache|"+
|
105
|
"Instant|instead|int-bounds|interval|in-timezone|invalid-str|invert|invocant|IO|"+
|
106
|
"IO::Notification.watch-path|is_trusted|is_type|isa|is-absolute|is-hidden|is-initial-thread|"+
|
107
|
"is-int|is-lazy|is-leap-year|isNaN|is-prime|is-relative|is-routine|is-setting|is-win|item|"+
|
108
|
"iterator|join|keep|kept|KERNELnames|key|keyof|keys|kill|kv|kxxv|l|lang|last|lastcall|later|"+
|
109
|
"lazy|lc|leading|level|line|lines|link|listen|live|local|lock|log|log10|lookup|lsb|"+
|
110
|
"MAIN|match|max|maxpairs|merge|message|method_table|methods|migrate|min|minmax|"+
|
111
|
"minpairs|minute|misplaced|Mix|MixHash|mkdir|mode|modified|month|move|mro|msb|multiness|"+
|
112
|
"name|named|named_names|narrow|nativecast|native-descriptor|nativesizeof|new|new_type|"+
|
113
|
"new-from-daycount|new-from-pairs|next|nextcallee|next-handle|nextsame|nextwith|NFC|NFD|"+
|
114
|
"NFKC|NFKD|nl-in|nl-out|nodemap|none|norm|not|note|now|nude|numerator|Numeric|of|"+
|
115
|
"offset|offset-in-hours|offset-in-minutes|old|on-close|one|on-switch|open|opened|"+
|
116
|
"operation|optional|ord|ords|orig|os-error|osname|out-buffer|pack|package|package-kind|"+
|
117
|
"package-name|packages|pair|pairs|pairup|parameter|params|parent|parent-name|parents|parse|"+
|
118
|
"parse-base|parsefile|parse-names|parts|path|path-sep|payload|peer-host|peer-port|periods|"+
|
119
|
"perl|permutations|phaser|pick|pickpairs|pid|placeholder|plus|polar|poll|polymod|pop|pos|"+
|
120
|
"positional|posix|postfix|postmatch|precomp-ext|precomp-target|pred|prefix|prematch|prepend|"+
|
121
|
"print|printf|print-nl|print-to|private|private_method_table|proc|produce|Promise|prompt|"+
|
122
|
"protect|pull-one|push|push-all|push-at-least|push-exactly|push-until-lazy|put|"+
|
123
|
"qualifier-type|quit|r|race|radix|rand|range|raw|re|read|readchars|readonly|"+
|
124
|
"ready|Real|reallocate|reals|reason|rebless|receive|recv|redispatcher|redo|reduce|"+
|
125
|
"rel2abs|relative|release|rename|repeated|replacement|report|reserved|resolve|"+
|
126
|
"restore|result|resume|rethrow|reverse|right|rindex|rmdir|roles_to_compose|"+
|
127
|
"rolish|roll|rootdir|roots|rotate|rotor|round|roundrobin|routine-type|run|rwx|s|"+
|
128
|
"samecase|samemark|samewith|say|schedule-on|scheduler|scope|sec|sech|second|seek|"+
|
129
|
"self|send|Set|set_hidden|set_name|set_package|set_rw|set_value|SetHash|"+
|
130
|
"set-instruments|setup_finalization|shape|share|shell|shift|sibling|sigil|"+
|
131
|
"sign|signal|signals|signature|sin|sinh|sink|sink-all|skip|skip-at-least|"+
|
132
|
"skip-at-least-pull-one|skip-one|sleep|sleep-timer|sleep-until|Slip|slurp|"+
|
133
|
"slurp-rest|slurpy|snap|snapper|so|socket-host|socket-port|sort|source|"+
|
134
|
"source-package|spawn|SPEC|splice|split|splitdir|splitpath|sprintf|spurt|"+
|
135
|
"sqrt|squish|srand|stable|start|started|starts-with|status|stderr|stdout|"+
|
136
|
"sub_signature|subbuf|subbuf-rw|subname|subparse|subst|subst-mutate|"+
|
137
|
"substr|substr-eq|substr-rw|succ|sum|Supply|symlink|t|tail|take|take-rw|"+
|
138
|
"tan|tanh|tap|target|target-name|tc|tclc|tell|then|throttle|throw|timezone|"+
|
139
|
"tmpdir|to|today|toggle|to-posix|total|trailing|trans|tree|trim|trim-leading|"+
|
140
|
"trim-trailing|truncate|truncated-to|trusts|try_acquire|trying|twigil|type|"+
|
141
|
"type_captures|typename|uc|udp|uncaught_handler|unimatch|uniname|uninames|"+
|
142
|
"uniparse|uniprop|uniprops|unique|unival|univals|unlink|unlock|unpack|unpolar|"+
|
143
|
"unshift|unwrap|updir|USAGE|utc|val|value|values|VAR|variable|verbose-config|"+
|
144
|
"version|VMnames|volume|vow|w|wait|warn|watch|watch-path|week|weekday-of-month|"+
|
145
|
"week-number|week-year|WHAT|WHERE|WHEREFORE|WHICH|WHO|whole-second|WHY|"+
|
146
|
"wordcase|words|workaround|wrap|write|write-to|yada|year|yield|yyyy-mm-dd|"+
|
147
|
"z|zip|zip-latest|"+
|
148
|
"plan|done-testing|bail-out|todo|skip|skip-rest|diag|subtest|pass|flunk|ok|"+
|
149
|
"nok|cmp-ok|is-deeply|isnt|is-approx|like|unlike|use-ok|isa-ok|does-ok|"+
|
150
|
"can-ok|dies-ok|lives-ok|eval-dies-ok|eval-lives-ok|throws-like|fails-like|"+
|
151
|
"rw|required|native|repr|export|symbol"
|
152
|
);
|
153
|
var constants_ascii = ("pi|Inf|tau|time");
|
154
|
|
155
|
var ops_txt = ("eq|ne|gt|lt|le|ge|div|gcd|lcm|leg|cmp|ff|fff|"+
|
156
|
"x|before|after|Z|X|and|or|andthen|notandthen|orelse|xor"
|
157
|
);
|
158
|
|
159
|
var keywordMapper = this.createKeywordMapper({
|
160
|
"keyword": keywords,
|
161
|
"storage.type" : types,
|
162
|
"constant.language": constants_ascii,
|
163
|
"support.function": builtinFunctions,
|
164
|
"keyword.operator": ops_txt
|
165
|
}, "identifier");
|
166
|
|
167
|
var moduleName = "[a-zA-Z_][a-zA-Z_0-9:-]*\\b";
|
168
|
var hex = { token : "constant.numeric", regex : "0x[0-9a-fA-F]+\\b" };
|
169
|
var num_rat = { token : "constant.numeric", regex : "[+-.]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" };
|
170
|
var num_with_ = { token : "constant.numeric", regex : "(?:\\d+_?\\d+)+\\b" };
|
171
|
var complex_numbers = { token : "constant.numeric", regex : "\\+?\\d+i\\b" };
|
172
|
var booleans = { token : "constant.language.boolean", regex : "(?:True|False)\\b" };
|
173
|
var versions = { token : "constant.other", regex : "v[0-9](?:\\.[a-zA-Z0-9*])*\\b" };
|
174
|
var lang_keywords = { token : keywordMapper, regex : "[a-zA-Z][\\:a-zA-Z0-9_-]*\\b" };
|
175
|
var variables = { token : "variable.language", regex : "[$@%&][?*!.]?[a-zA-Z0-9_-]+\\b" };
|
176
|
var vars_special = { token: "variable.language", regex : "\\$[/|!]?|@\\$/" };
|
177
|
var ops_char = { token : "keyword.operator", regex : "=|<|>|\\+|\\*|-|/|~|%|\\?|!|\\^|\\.|\\:|\\,|"+
|
178
|
"»|«|\\||\\&|⚛|∘" };
|
179
|
var constants_unicode = { token : "constant.language", regex : "𝑒|π|τ|∞" };
|
180
|
var qstrings = { token : "string.quoted.single", regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" };
|
181
|
var word_quoting = { token : "string.quoted.single", regex : "[<](?:[a-zA-Z0-9 ])*[>]"};
|
182
|
var regexp = {
|
183
|
token : "string.regexp",
|
184
|
regex : "[m|rx]?[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" };
|
185
|
|
186
|
|
187
|
this.$rules = {
|
188
|
"start" : [
|
189
|
{
|
190
|
token : "comment.block", // Embedded Comments - Parentheses
|
191
|
regex : "#[`|=]\\(.*\\)"
|
192
|
}, {
|
193
|
token : "comment.block", // Embedded Comments - Brackets
|
194
|
regex : "#[`|=]\\[.*\\]"
|
195
|
}, {
|
196
|
token : "comment.doc", // Multiline Comments
|
197
|
regex : "^=(?:begin)\\b",
|
198
|
next : "block_comment"
|
199
|
}, {
|
200
|
token : "string.unquoted", // q Heredocs
|
201
|
regex : "q[x|w]?\\:to/END/;",
|
202
|
next : "qheredoc"
|
203
|
}, {
|
204
|
token : "string.unquoted", // qq Heredocs
|
205
|
regex : "qq[x|w]?\\:to/END/;",
|
206
|
next : "qqheredoc"
|
207
|
},
|
208
|
regexp,
|
209
|
qstrings
|
210
|
, {
|
211
|
token : "string.quoted.double", // Double Quoted String
|
212
|
regex : '"',
|
213
|
next : "qqstring"
|
214
|
},
|
215
|
word_quoting
|
216
|
, {
|
217
|
token: ["keyword", "text", "variable.module"], // use - Module Names, Pragmas, etc.
|
218
|
regex: "(use)(\\s+)((?:"+moduleName+"\\.?)*)"
|
219
|
},
|
220
|
hex,
|
221
|
num_rat,
|
222
|
num_with_,
|
223
|
complex_numbers,
|
224
|
booleans,
|
225
|
versions,
|
226
|
lang_keywords,
|
227
|
variables,
|
228
|
vars_special,
|
229
|
ops_char,
|
230
|
constants_unicode
|
231
|
, {
|
232
|
token : "comment", // Sigle Line Comments
|
233
|
regex : "#.*$"
|
234
|
}, {
|
235
|
token : "lparen",
|
236
|
regex : "[[({]"
|
237
|
}, {
|
238
|
token : "rparen",
|
239
|
regex : "[\\])}]"
|
240
|
}, {
|
241
|
token : "text",
|
242
|
regex : "\\s+"
|
243
|
}
|
244
|
],
|
245
|
"qqstring" : [
|
246
|
{
|
247
|
token : "constant.language.escape",
|
248
|
regex : '\\\\(?:[nrtef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
|
249
|
},
|
250
|
variables,
|
251
|
vars_special
|
252
|
, {
|
253
|
token : "lparen",
|
254
|
regex : "{",
|
255
|
next : "qqinterpolation"
|
256
|
}, {
|
257
|
token : "string.quoted.double",
|
258
|
regex : '"',
|
259
|
next : "start"
|
260
|
}, {
|
261
|
defaultToken : "string.quoted.double"
|
262
|
}
|
263
|
],
|
264
|
"qqinterpolation" : [
|
265
|
hex,
|
266
|
num_rat,
|
267
|
num_with_,
|
268
|
complex_numbers,
|
269
|
booleans,
|
270
|
versions,
|
271
|
lang_keywords,
|
272
|
variables,
|
273
|
vars_special,
|
274
|
ops_char,
|
275
|
constants_unicode,
|
276
|
qstrings,
|
277
|
regexp,
|
278
|
|
279
|
{
|
280
|
token: "rparen",
|
281
|
regex: "}",
|
282
|
next : "qqstring"
|
283
|
}
|
284
|
],
|
285
|
"block_comment": [
|
286
|
{
|
287
|
token: "comment.doc",
|
288
|
regex: "^=end +[a-zA-Z_0-9]*",
|
289
|
next: "start"
|
290
|
},
|
291
|
{
|
292
|
defaultToken: "comment.doc"
|
293
|
}
|
294
|
],
|
295
|
"qheredoc": [
|
296
|
{
|
297
|
token: "string.unquoted",
|
298
|
regex: "END$",
|
299
|
next: "start"
|
300
|
}, {
|
301
|
defaultToken: "string.unquoted"
|
302
|
}
|
303
|
],
|
304
|
"qqheredoc": [
|
305
|
variables,
|
306
|
vars_special,
|
307
|
{
|
308
|
token : "lparen",
|
309
|
regex : "{",
|
310
|
next : "qqheredocinterpolation"
|
311
|
}, {
|
312
|
token: "string.unquoted",
|
313
|
regex: "END$",
|
314
|
next: "start"
|
315
|
}, {
|
316
|
defaultToken: "string.unquoted"
|
317
|
}
|
318
|
],
|
319
|
"qqheredocinterpolation" : [
|
320
|
hex,
|
321
|
num_rat,
|
322
|
num_with_,
|
323
|
complex_numbers,
|
324
|
booleans,
|
325
|
versions,
|
326
|
lang_keywords,
|
327
|
variables,
|
328
|
vars_special,
|
329
|
ops_char,
|
330
|
constants_unicode,
|
331
|
qstrings,
|
332
|
regexp,
|
333
|
{
|
334
|
token: "rparen",
|
335
|
regex: "}",
|
336
|
next : "qqheredoc"
|
337
|
}
|
338
|
]
|
339
|
};
|
340
|
};
|
341
|
|
342
|
oop.inherits(Perl6HighlightRules, TextHighlightRules);
|
343
|
|
344
|
exports.Perl6HighlightRules = Perl6HighlightRules;
|
345
|
});
|
346
|
|
347
|
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
|
348
|
"use strict";
|
349
|
|
350
|
var Range = require("../range").Range;
|
351
|
|
352
|
var MatchingBraceOutdent = function() {};
|
353
|
|
354
|
(function() {
|
355
|
|
356
|
this.checkOutdent = function(line, input) {
|
357
|
if (! /^\s+$/.test(line))
|
358
|
return false;
|
359
|
|
360
|
return /^\s*\}/.test(input);
|
361
|
};
|
362
|
|
363
|
this.autoOutdent = function(doc, row) {
|
364
|
var line = doc.getLine(row);
|
365
|
var match = line.match(/^(\s*\})/);
|
366
|
|
367
|
if (!match) return 0;
|
368
|
|
369
|
var column = match[1].length;
|
370
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
371
|
|
372
|
if (!openBracePos || openBracePos.row == row) return 0;
|
373
|
|
374
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
375
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
376
|
};
|
377
|
|
378
|
this.$getIndent = function(line) {
|
379
|
return line.match(/^\s*/)[0];
|
380
|
};
|
381
|
|
382
|
}).call(MatchingBraceOutdent.prototype);
|
383
|
|
384
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
385
|
});
|
386
|
|
387
|
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
388
|
"use strict";
|
389
|
|
390
|
var oop = require("../../lib/oop");
|
391
|
var Range = require("../../range").Range;
|
392
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
393
|
|
394
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
395
|
if (commentRegex) {
|
396
|
this.foldingStartMarker = new RegExp(
|
397
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
398
|
);
|
399
|
this.foldingStopMarker = new RegExp(
|
400
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
401
|
);
|
402
|
}
|
403
|
};
|
404
|
oop.inherits(FoldMode, BaseFoldMode);
|
405
|
|
406
|
(function() {
|
407
|
|
408
|
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
|
409
|
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
|
410
|
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
411
|
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
412
|
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
413
|
this._getFoldWidgetBase = this.getFoldWidget;
|
414
|
this.getFoldWidget = function(session, foldStyle, row) {
|
415
|
var line = session.getLine(row);
|
416
|
|
417
|
if (this.singleLineBlockCommentRe.test(line)) {
|
418
|
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
419
|
return "";
|
420
|
}
|
421
|
|
422
|
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
423
|
|
424
|
if (!fw && this.startRegionRe.test(line))
|
425
|
return "start"; // lineCommentRegionStart
|
426
|
|
427
|
return fw;
|
428
|
};
|
429
|
|
430
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
431
|
var line = session.getLine(row);
|
432
|
|
433
|
if (this.startRegionRe.test(line))
|
434
|
return this.getCommentRegionBlock(session, line, row);
|
435
|
|
436
|
var match = line.match(this.foldingStartMarker);
|
437
|
if (match) {
|
438
|
var i = match.index;
|
439
|
|
440
|
if (match[1])
|
441
|
return this.openingBracketBlock(session, match[1], row, i);
|
442
|
|
443
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
444
|
|
445
|
if (range && !range.isMultiLine()) {
|
446
|
if (forceMultiline) {
|
447
|
range = this.getSectionRange(session, row);
|
448
|
} else if (foldStyle != "all")
|
449
|
range = null;
|
450
|
}
|
451
|
|
452
|
return range;
|
453
|
}
|
454
|
|
455
|
if (foldStyle === "markbegin")
|
456
|
return;
|
457
|
|
458
|
var match = line.match(this.foldingStopMarker);
|
459
|
if (match) {
|
460
|
var i = match.index + match[0].length;
|
461
|
|
462
|
if (match[1])
|
463
|
return this.closingBracketBlock(session, match[1], row, i);
|
464
|
|
465
|
return session.getCommentFoldRange(row, i, -1);
|
466
|
}
|
467
|
};
|
468
|
|
469
|
this.getSectionRange = function(session, row) {
|
470
|
var line = session.getLine(row);
|
471
|
var startIndent = line.search(/\S/);
|
472
|
var startRow = row;
|
473
|
var startColumn = line.length;
|
474
|
row = row + 1;
|
475
|
var endRow = row;
|
476
|
var maxRow = session.getLength();
|
477
|
while (++row < maxRow) {
|
478
|
line = session.getLine(row);
|
479
|
var indent = line.search(/\S/);
|
480
|
if (indent === -1)
|
481
|
continue;
|
482
|
if (startIndent > indent)
|
483
|
break;
|
484
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
485
|
|
486
|
if (subRange) {
|
487
|
if (subRange.start.row <= startRow) {
|
488
|
break;
|
489
|
} else if (subRange.isMultiLine()) {
|
490
|
row = subRange.end.row;
|
491
|
} else if (startIndent == indent) {
|
492
|
break;
|
493
|
}
|
494
|
}
|
495
|
endRow = row;
|
496
|
}
|
497
|
|
498
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
499
|
};
|
500
|
this.getCommentRegionBlock = function(session, line, row) {
|
501
|
var startColumn = line.search(/\s*$/);
|
502
|
var maxRow = session.getLength();
|
503
|
var startRow = row;
|
504
|
|
505
|
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
506
|
var depth = 1;
|
507
|
while (++row < maxRow) {
|
508
|
line = session.getLine(row);
|
509
|
var m = re.exec(line);
|
510
|
if (!m) continue;
|
511
|
if (m[1]) depth--;
|
512
|
else depth++;
|
513
|
|
514
|
if (!depth) break;
|
515
|
}
|
516
|
|
517
|
var endRow = row;
|
518
|
if (endRow > startRow) {
|
519
|
return new Range(startRow, startColumn, endRow, line.length);
|
520
|
}
|
521
|
};
|
522
|
|
523
|
}).call(FoldMode.prototype);
|
524
|
|
525
|
});
|
526
|
|
527
|
ace.define("ace/mode/perl6",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/perl6_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"], function(require, exports, module) {
|
528
|
"use strict";
|
529
|
|
530
|
var oop = require("../lib/oop");
|
531
|
var TextMode = require("./text").Mode;
|
532
|
var Perl6HighlightRules = require("./perl6_highlight_rules").Perl6HighlightRules;
|
533
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
534
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
535
|
|
536
|
var Mode = function() {
|
537
|
this.HighlightRules = Perl6HighlightRules;
|
538
|
|
539
|
this.$outdent = new MatchingBraceOutdent();
|
540
|
this.foldingRules = new CStyleFoldMode({start: "^=(begin)\\b", end: "^=(end)\\b"});
|
541
|
this.$behaviour = this.$defaultBehaviour;
|
542
|
};
|
543
|
oop.inherits(Mode, TextMode);
|
544
|
|
545
|
(function() {
|
546
|
|
547
|
this.lineCommentStart = "#";
|
548
|
this.blockComment = [
|
549
|
{start: "=begin", end: "=end", lineStartOnly: true},
|
550
|
{start: "=item", end: "=end", lineStartOnly: true}
|
551
|
];
|
552
|
|
553
|
|
554
|
this.getNextLineIndent = function(state, line, tab) {
|
555
|
var indent = this.$getIndent(line);
|
556
|
|
557
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
558
|
var tokens = tokenizedLine.tokens;
|
559
|
|
560
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
561
|
return indent;
|
562
|
}
|
563
|
|
564
|
if (state == "start") {
|
565
|
var match = line.match(/^.*[\{\(\[:]\s*$/);
|
566
|
if (match) {
|
567
|
indent += tab;
|
568
|
}
|
569
|
}
|
570
|
|
571
|
return indent;
|
572
|
};
|
573
|
|
574
|
this.checkOutdent = function(state, line, input) {
|
575
|
return this.$outdent.checkOutdent(line, input);
|
576
|
};
|
577
|
|
578
|
this.autoOutdent = function(state, doc, row) {
|
579
|
this.$outdent.autoOutdent(doc, row);
|
580
|
};
|
581
|
|
582
|
this.$id = "ace/mode/perl6";
|
583
|
}).call(Mode.prototype);
|
584
|
|
585
|
exports.Mode = Mode;
|
586
|
}); (function() {
|
587
|
ace.require(["ace/mode/perl6"], function(m) {
|
588
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
589
|
module.exports = m;
|
590
|
}
|
591
|
});
|
592
|
})();
|
593
|
|