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