212 return 0.9 |
212 return 0.9 |
213 |
213 |
214 |
214 |
215 class Perl6Lexer(ExtendedRegexLexer): |
215 class Perl6Lexer(ExtendedRegexLexer): |
216 """ |
216 """ |
217 For `Perl 6 <http://www.perl6.org>`_ source code. |
217 For `Raku <https://www.raku.org>`_ (a.k.a. Perl 6) source code. |
218 |
218 |
219 .. versionadded:: 2.0 |
219 .. versionadded:: 2.0 |
220 """ |
220 """ |
221 |
221 |
222 name = 'Perl6' |
222 name = 'Perl6' |
223 aliases = ['perl6', 'pl6'] |
223 aliases = ['perl6', 'pl6', 'raku'] |
224 filenames = ['*.pl', '*.pm', '*.nqp', '*.p6', '*.6pl', '*.p6l', '*.pl6', |
224 filenames = ['*.pl', '*.pm', '*.nqp', '*.p6', '*.6pl', '*.p6l', '*.pl6', |
225 '*.6pm', '*.p6m', '*.pm6', '*.t'] |
225 '*.6pm', '*.p6m', '*.pm6', '*.t', '*.raku', '*.rakumod', |
|
226 '*.rakutest', '*.rakudoc'] |
226 mimetypes = ['text/x-perl6', 'application/x-perl6'] |
227 mimetypes = ['text/x-perl6', 'application/x-perl6'] |
227 flags = re.MULTILINE | re.DOTALL | re.UNICODE |
228 flags = re.MULTILINE | re.DOTALL | re.UNICODE |
228 |
229 |
229 PERL6_IDENTIFIER_RANGE = r"['\w:-]" |
230 PERL6_IDENTIFIER_RANGE = r"['\w:-]" |
230 |
231 |
231 PERL6_KEYWORDS = ( |
232 PERL6_KEYWORDS = ( |
232 'BEGIN', 'CATCH', 'CHECK', 'CONTROL', 'END', 'ENTER', 'FIRST', 'INIT', |
233 #Phasers |
233 'KEEP', 'LAST', 'LEAVE', 'NEXT', 'POST', 'PRE', 'START', 'TEMP', |
234 'BEGIN','CATCH','CHECK','CLOSE','CONTROL','DOC','END','ENTER','FIRST', |
234 'UNDO', 'as', 'assoc', 'async', 'augment', 'binary', 'break', 'but', |
235 'INIT','KEEP','LAST','LEAVE','NEXT','POST','PRE','QUIT','UNDO', |
235 'cached', 'category', 'class', 'constant', 'contend', 'continue', |
236 #Keywords |
236 'copy', 'deep', 'default', 'defequiv', 'defer', 'die', 'do', 'else', |
237 'anon','augment','but','class','constant','default','does','else', |
237 'elsif', 'enum', 'equiv', 'exit', 'export', 'fail', 'fatal', 'for', |
238 'elsif','enum','for','gather','given','grammar','has','if','import', |
238 'gather', 'given', 'goto', 'grammar', 'handles', 'has', 'if', 'inline', |
239 'is','let','loop','made','make','method','module','multi','my','need', |
239 'irs', 'is', 'last', 'leave', 'let', 'lift', 'loop', 'looser', 'macro', |
240 'orwith','our','proceed','proto','repeat','require','return', |
240 'make', 'maybe', 'method', 'module', 'multi', 'my', 'next', 'of', |
241 'return-rw','returns','role','rule','state','sub','submethod','subset', |
241 'ofs', 'only', 'oo', 'ors', 'our', 'package', 'parsed', 'prec', |
242 'succeed','supersede','token','try','unit','unless','until','use', |
242 'proto', 'readonly', 'redo', 'ref', 'regex', 'reparsed', 'repeat', |
243 'when','while','with','without', |
243 'require', 'required', 'return', 'returns', 'role', 'rule', 'rw', |
244 #Traits |
244 'self', 'slang', 'state', 'sub', 'submethod', 'subset', 'supersede', |
245 'export','native','repr','required','rw','symbol', |
245 'take', 'temp', 'tighter', 'token', 'trusts', 'try', 'unary', |
|
246 'unless', 'until', 'use', 'warn', 'when', 'where', 'while', 'will', |
|
247 ) |
246 ) |
248 |
247 |
249 PERL6_BUILTINS = ( |
248 PERL6_BUILTINS = ( |
250 'ACCEPTS', 'HOW', 'REJECTS', 'VAR', 'WHAT', 'WHENCE', 'WHERE', 'WHICH', |
249 'ACCEPTS','abs','abs2rel','absolute','accept','accessed','acos', |
251 'WHO', 'abs', 'acos', 'acosec', 'acosech', 'acosh', 'acotan', 'acotanh', |
250 'acosec','acosech','acosh','acotan','acotanh','acquire','act','action', |
252 'all', 'any', 'approx', 'arity', 'asec', 'asech', 'asin', 'asinh', |
251 'actions','add','add_attribute','add_enum_value','add_fallback', |
253 'assuming', 'atan', 'atan2', 'atanh', 'attr', 'bless', 'body', 'by', |
252 'add_method','add_parent','add_private_method','add_role','add_trustee', |
254 'bytes', 'caller', 'callsame', 'callwith', 'can', 'capitalize', 'cat', |
253 'adverb','after','all','allocate','allof','allowed','alternative-names', |
255 'ceiling', 'chars', 'chmod', 'chomp', 'chop', 'chr', 'chroot', |
254 'annotations','antipair','antipairs','any','anyof','app_lifetime', |
256 'circumfix', 'cis', 'classify', 'clone', 'close', 'cmp_ok', 'codes', |
255 'append','arch','archname','args','arity','Array','asec','asech','asin', |
257 'comb', 'connect', 'contains', 'context', 'cos', 'cosec', 'cosech', |
256 'asinh','ASSIGN-KEY','ASSIGN-POS','assuming','ast','at','atan','atan2', |
258 'cosh', 'cotan', 'cotanh', 'count', 'defined', 'delete', 'diag', |
257 'atanh','AT-KEY','atomic-assign','atomic-dec-fetch','atomic-fetch', |
259 'dies_ok', 'does', 'e', 'each', 'eager', 'elems', 'end', 'eof', 'eval', |
258 'atomic-fetch-add','atomic-fetch-dec','atomic-fetch-inc', |
260 'eval_dies_ok', 'eval_elsewhere', 'eval_lives_ok', 'evalfile', 'exists', |
259 'atomic-fetch-sub','atomic-inc-fetch','AT-POS','attributes','auth', |
261 'exp', 'first', 'flip', 'floor', 'flunk', 'flush', 'fmt', 'force_todo', |
260 'await','backtrace','Bag','BagHash','bail-out','base','basename', |
262 'fork', 'from', 'getc', 'gethost', 'getlogin', 'getpeername', 'getpw', |
261 'base-repeating','batch','BIND-KEY','BIND-POS','bind-stderr', |
263 'gmtime', 'graphs', 'grep', 'hints', 'hyper', 'im', 'index', 'infix', |
262 'bind-stdin','bind-stdout','bind-udp','bits','bless','block','Bool', |
264 'invert', 'is_approx', 'is_deeply', 'isa', 'isa_ok', 'isnt', 'iterator', |
263 'bool-only','bounds','break','Bridge','broken','BUILD','build-date', |
265 'join', 'key', 'keys', 'kill', 'kv', 'lastcall', 'lazy', 'lc', 'lcfirst', |
264 'bytes','cache','callframe','calling-package','CALL-ME','callsame', |
266 'like', 'lines', 'link', 'lives_ok', 'localtime', 'log', 'log10', 'map', |
265 'callwith','can','cancel','candidates','cando','can-ok','canonpath', |
267 'max', 'min', 'minmax', 'name', 'new', 'nextsame', 'nextwith', 'nfc', |
266 'caps','caption','Capture','cas','catdir','categorize','categorize-list', |
268 'nfd', 'nfkc', 'nfkd', 'nok_error', 'nonce', 'none', 'normalize', 'not', |
267 'catfile','catpath','cause','ceiling','cglobal','changed','Channel', |
269 'nothing', 'ok', 'once', 'one', 'open', 'opendir', 'operator', 'ord', |
268 'chars','chdir','child','child-name','child-typename','chmod','chomp', |
270 'p5chomp', 'p5chop', 'pack', 'pair', 'pairs', 'pass', 'perl', 'pi', |
269 'chop','chr','chrs','chunks','cis','classify','classify-list','cleanup', |
271 'pick', 'plan', 'plan_ok', 'polar', 'pop', 'pos', 'postcircumfix', |
270 'clone','close','closed','close-stdin','cmp-ok','code','codes','collate', |
272 'postfix', 'pred', 'prefix', 'print', 'printf', 'push', 'quasi', |
271 'column','comb','combinations','command','comment','compiler','Complex', |
273 'quotemeta', 'rand', 're', 'read', 'readdir', 'readline', 'reduce', |
272 'compose','compose_type','composer','condition','config', |
274 'reverse', 'rewind', 'rewinddir', 'rindex', 'roots', 'round', |
273 'configure_destroy','configure_type_checking','conj','connect', |
275 'roundrobin', 'run', 'runinstead', 'sameaccent', 'samecase', 'say', |
274 'constraints','construct','contains','contents','copy','cos','cosec', |
276 'sec', 'sech', 'sech', 'seek', 'shape', 'shift', 'sign', 'signature', |
275 'cosech','cosh','cotan','cotanh','count','count-only','cpu-cores', |
277 'sin', 'sinh', 'skip', 'skip_rest', 'sleep', 'slurp', 'sort', 'splice', |
276 'cpu-usage','CREATE','create_type','cross','cue','curdir','curupdir','d', |
278 'split', 'sprintf', 'sqrt', 'srand', 'strand', 'subst', 'substr', 'succ', |
277 'Date','DateTime','day','daycount','day-of-month','day-of-week', |
279 'sum', 'symlink', 'tan', 'tanh', 'throws_ok', 'time', 'times', 'to', |
278 'day-of-year','days-in-month','declaration','decode','decoder','deepmap', |
280 'todo', 'trim', 'trim_end', 'trim_start', 'true', 'truncate', 'uc', |
279 'default','defined','DEFINITE','delayed','DELETE-KEY','DELETE-POS', |
281 'ucfirst', 'undef', 'undefine', 'uniq', 'unlike', 'unlink', 'unpack', |
280 'denominator','desc','DESTROY','destroyers','devnull','diag', |
282 'unpolar', 'unshift', 'unwrap', 'use_ok', 'value', 'values', 'vec', |
281 'did-you-mean','die','dies-ok','dir','dirname','dir-sep','DISTROnames', |
283 'version_lt', 'void', 'wait', 'want', 'wrap', 'write', 'zip', |
282 'do','does','does-ok','done','done-testing','duckmap','dynamic','e', |
|
283 'eager','earlier','elems','emit','enclosing','encode','encoder', |
|
284 'encoding','end','ends-with','enum_from_value','enum_value_list', |
|
285 'enum_values','enums','eof','EVAL','eval-dies-ok','EVALFILE', |
|
286 'eval-lives-ok','exception','excludes-max','excludes-min','EXISTS-KEY', |
|
287 'EXISTS-POS','exit','exitcode','exp','expected','explicitly-manage', |
|
288 'expmod','extension','f','fail','fails-like','fc','feature','file', |
|
289 'filename','find_method','find_method_qualified','finish','first','flat', |
|
290 'flatmap','flip','floor','flunk','flush','fmt','format','formatter', |
|
291 'freeze','from','from-list','from-loop','from-posix','full', |
|
292 'full-barrier','get','get_value','getc','gist','got','grab','grabpairs', |
|
293 'grep','handle','handled','handles','hardware','has_accessor','Hash', |
|
294 'head','headers','hh-mm-ss','hidden','hides','hour','how','hyper','id', |
|
295 'illegal','im','in','indent','index','indices','indir','infinite', |
|
296 'infix','infix:<+>','infix:<->','install_method_cache','Instant', |
|
297 'instead','Int','int-bounds','interval','in-timezone','invalid-str', |
|
298 'invert','invocant','IO','IO::Notification.watch-path','is_trusted', |
|
299 'is_type','isa','is-absolute','isa-ok','is-approx','is-deeply', |
|
300 'is-hidden','is-initial-thread','is-int','is-lazy','is-leap-year', |
|
301 'isNaN','isnt','is-prime','is-relative','is-routine','is-setting', |
|
302 'is-win','item','iterator','join','keep','kept','KERNELnames','key', |
|
303 'keyof','keys','kill','kv','kxxv','l','lang','last','lastcall','later', |
|
304 'lazy','lc','leading','level','like','line','lines','link','List', |
|
305 'listen','live','lives-ok','local','lock','log','log10','lookup','lsb', |
|
306 'made','MAIN','make','Map','match','max','maxpairs','merge','message', |
|
307 'method','method_table','methods','migrate','min','minmax','minpairs', |
|
308 'minute','misplaced','Mix','MixHash','mkdir','mode','modified','month', |
|
309 'move','mro','msb','multi','multiness','my','name','named','named_names', |
|
310 'narrow','nativecast','native-descriptor','nativesizeof','new','new_type', |
|
311 'new-from-daycount','new-from-pairs','next','nextcallee','next-handle', |
|
312 'nextsame','nextwith','NFC','NFD','NFKC','NFKD','nl-in','nl-out', |
|
313 'nodemap','nok','none','norm','not','note','now','nude','Num', |
|
314 'numerator','Numeric','of','offset','offset-in-hours','offset-in-minutes', |
|
315 'ok','old','on-close','one','on-switch','open','opened','operation', |
|
316 'optional','ord','ords','orig','os-error','osname','out-buffer','pack', |
|
317 'package','package-kind','package-name','packages','pair','pairs', |
|
318 'pairup','parameter','params','parent','parent-name','parents','parse', |
|
319 'parse-base','parsefile','parse-names','parts','pass','path','path-sep', |
|
320 'payload','peer-host','peer-port','periods','perl','permutations','phaser', |
|
321 'pick','pickpairs','pid','placeholder','plan','plus','polar','poll', |
|
322 'polymod','pop','pos','positional','posix','postfix','postmatch', |
|
323 'precomp-ext','precomp-target','pred','prefix','prematch','prepend', |
|
324 'print','printf','print-nl','print-to','private','private_method_table', |
|
325 'proc','produce','Promise','prompt','protect','pull-one','push', |
|
326 'push-all','push-at-least','push-exactly','push-until-lazy','put', |
|
327 'qualifier-type','quit','r','race','radix','rand','range','Rat','raw', |
|
328 're','read','readchars','readonly','ready','Real','reallocate','reals', |
|
329 'reason','rebless','receive','recv','redispatcher','redo','reduce', |
|
330 'rel2abs','relative','release','rename','repeated','replacement', |
|
331 'report','reserved','resolve','restore','result','resume','rethrow', |
|
332 'reverse','right','rindex','rmdir','role','roles_to_compose','rolish', |
|
333 'roll','rootdir','roots','rotate','rotor','round','roundrobin', |
|
334 'routine-type','run','rwx','s','samecase','samemark','samewith','say', |
|
335 'schedule-on','scheduler','scope','sec','sech','second','seek','self', |
|
336 'send','Set','set_hidden','set_name','set_package','set_rw','set_value', |
|
337 'SetHash','set-instruments','setup_finalization','shape','share','shell', |
|
338 'shift','sibling','sigil','sign','signal','signals','signature','sin', |
|
339 'sinh','sink','sink-all','skip','skip-at-least','skip-at-least-pull-one', |
|
340 'skip-one','skip-rest','sleep','sleep-timer','sleep-until','Slip','slurp', |
|
341 'slurp-rest','slurpy','snap','snapper','so','socket-host','socket-port', |
|
342 'sort','source','source-package','spawn','SPEC','splice','split', |
|
343 'splitdir','splitpath','sprintf','spurt','sqrt','squish','srand','stable', |
|
344 'start','started','starts-with','status','stderr','stdout','Str', |
|
345 'sub_signature','subbuf','subbuf-rw','subname','subparse','subst', |
|
346 'subst-mutate','substr','substr-eq','substr-rw','subtest','succ','sum', |
|
347 'Supply','symlink','t','tail','take','take-rw','tan','tanh','tap', |
|
348 'target','target-name','tc','tclc','tell','then','throttle','throw', |
|
349 'throws-like','timezone','tmpdir','to','today','todo','toggle','to-posix', |
|
350 'total','trailing','trans','tree','trim','trim-leading','trim-trailing', |
|
351 'truncate','truncated-to','trusts','try_acquire','trying','twigil','type', |
|
352 'type_captures','typename','uc','udp','uncaught_handler','unimatch', |
|
353 'uniname','uninames','uniparse','uniprop','uniprops','unique','unival', |
|
354 'univals','unlike','unlink','unlock','unpack','unpolar','unshift', |
|
355 'unwrap','updir','USAGE','use-ok','utc','val','value','values','VAR', |
|
356 'variable','verbose-config','version','VMnames','volume','vow','w','wait', |
|
357 'warn','watch','watch-path','week','weekday-of-month','week-number', |
|
358 'week-year','WHAT','when','WHERE','WHEREFORE','WHICH','WHO', |
|
359 'whole-second','WHY','wordcase','words','workaround','wrap','write', |
|
360 'write-to','x','yada','year','yield','yyyy-mm-dd','z','zip','zip-latest', |
|
361 |
284 ) |
362 ) |
285 |
363 |
286 PERL6_BUILTIN_CLASSES = ( |
364 PERL6_BUILTIN_CLASSES = ( |
287 'Abstraction', 'Any', 'AnyChar', 'Array', 'Associative', 'Bag', 'Bit', |
365 #Booleans |
288 'Blob', 'Block', 'Bool', 'Buf', 'Byte', 'Callable', 'Capture', 'Char', 'Class', |
366 'False','True', |
289 'Code', 'Codepoint', 'Comparator', 'Complex', 'Decreasing', 'Exception', |
367 #Classes |
290 'Failure', 'False', 'Grammar', 'Grapheme', 'Hash', 'IO', 'Increasing', |
368 'Any','Array','Associative','AST','atomicint','Attribute','Backtrace', |
291 'Int', 'Junction', 'KeyBag', 'KeyExtractor', 'KeyHash', 'KeySet', |
369 'Backtrace::Frame','Bag','Baggy','BagHash','Blob','Block','Bool','Buf', |
292 'KitchenSink', 'List', 'Macro', 'Mapping', 'Match', 'Matcher', 'Method', |
370 'Callable','CallFrame','Cancellation','Capture','CArray','Channel','Code', |
293 'Module', 'Num', 'Object', 'Ordered', 'Ordering', 'OrderingPair', |
371 'compiler','Complex','ComplexStr','Cool','CurrentThreadScheduler', |
294 'Package', 'Pair', 'Positional', 'Proxy', 'Range', 'Rat', 'Regex', |
372 'Cursor','Date','Dateish','DateTime','Distro','Duration','Encoding', |
295 'Role', 'Routine', 'Scalar', 'Seq', 'Set', 'Signature', 'Str', 'StrLen', |
373 'Exception','Failure','FatRat','Grammar','Hash','HyperWhatever','Instant', |
296 'StrPos', 'Sub', 'Submethod', 'True', 'UInt', 'Undef', 'Version', 'Void', |
374 'Int','int16','int32','int64','int8','IntStr','IO','IO::ArgFiles', |
297 'Whatever', 'bit', 'bool', 'buf', 'buf1', 'buf16', 'buf2', 'buf32', |
375 'IO::CatHandle','IO::Handle','IO::Notification','IO::Path', |
298 'buf4', 'buf64', 'buf8', 'complex', 'int', 'int1', 'int16', 'int2', |
376 'IO::Path::Cygwin','IO::Path::QNX','IO::Path::Unix','IO::Path::Win32', |
299 'int32', 'int4', 'int64', 'int8', 'num', 'rat', 'rat1', 'rat16', 'rat2', |
377 'IO::Pipe','IO::Socket','IO::Socket::Async','IO::Socket::INET','IO::Spec', |
300 'rat32', 'rat4', 'rat64', 'rat8', 'uint', 'uint1', 'uint16', 'uint2', |
378 'IO::Spec::Cygwin','IO::Spec::QNX','IO::Spec::Unix','IO::Spec::Win32', |
301 'uint32', 'uint4', 'uint64', 'uint8', 'utf16', 'utf32', 'utf8', |
379 'IO::Special','Iterable','Iterator','Junction','Kernel','Label','List', |
|
380 'Lock','Lock::Async','long','longlong','Macro','Map','Match', |
|
381 'Metamodel::AttributeContainer','Metamodel::C3MRO','Metamodel::ClassHOW', |
|
382 'Metamodel::EnumHOW','Metamodel::Finalization','Metamodel::MethodContainer', |
|
383 'Metamodel::MROBasedMethodDispatch','Metamodel::MultipleInheritance', |
|
384 'Metamodel::Naming','Metamodel::Primitives','Metamodel::PrivateMethodContainer', |
|
385 'Metamodel::RoleContainer','Metamodel::Trusting','Method','Mix','MixHash', |
|
386 'Mixy','Mu','NFC','NFD','NFKC','NFKD','Nil','Num','num32','num64', |
|
387 'Numeric','NumStr','ObjAt','Order','Pair','Parameter','Perl','Pod::Block', |
|
388 'Pod::Block::Code','Pod::Block::Comment','Pod::Block::Declarator', |
|
389 'Pod::Block::Named','Pod::Block::Para','Pod::Block::Table','Pod::Heading', |
|
390 'Pod::Item','Pointer','Positional','PositionalBindFailover','Proc', |
|
391 'Proc::Async','Promise','Proxy','PseudoStash','QuantHash','Range','Rat', |
|
392 'Rational','RatStr','Real','Regex','Routine','Scalar','Scheduler', |
|
393 'Semaphore','Seq','Set','SetHash','Setty','Signature','size_t','Slip', |
|
394 'Stash','Str','StrDistance','Stringy','Sub','Submethod','Supplier', |
|
395 'Supplier::Preserving','Supply','Systemic','Tap','Telemetry', |
|
396 'Telemetry::Instrument::Thread','Telemetry::Instrument::Usage', |
|
397 'Telemetry::Period','Telemetry::Sampler','Thread','ThreadPoolScheduler', |
|
398 'UInt','uint16','uint32','uint64','uint8','Uni','utf8','Variable', |
|
399 'Version','VM','Whatever','WhateverCode','WrapHandle' |
302 ) |
400 ) |
303 |
401 |
304 PERL6_OPERATORS = ( |
402 PERL6_OPERATORS = ( |
305 'X', 'Z', 'after', 'also', 'and', 'andthen', 'before', 'cmp', 'div', |
403 'X', 'Z', 'after', 'also', 'and', 'andthen', 'before', 'cmp', 'div', |
306 'eq', 'eqv', 'extra', 'ff', 'fff', 'ge', 'gt', 'le', 'leg', 'lt', 'm', |
404 'eq', 'eqv', 'extra', 'ff', 'fff', 'ge', 'gt', 'le', 'leg', 'lt', 'm', |