├── .gitignore ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── doc └── vim-raku.txt ├── ftdetect └── raku.vim ├── ftplugin └── raku.vim ├── indent └── raku.vim ├── syntax └── raku.vim ├── t └── 07_raku_folding.t ├── t_source └── raku │ ├── basic.t │ ├── basic.t.html │ ├── comments.t │ ├── comments.t.html │ ├── grammars.t │ ├── grammars.t.html │ ├── metaops.t │ ├── metaops.t.html │ ├── pod.t │ ├── pod.t.html │ ├── quoting.t │ └── quoting.t.html └── tools └── preproc.pl /.gitignore: -------------------------------------------------------------------------------- 1 | doc/tags 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Reporting Issues 2 | 3 | When submitting an issue relating to highlighting/folding, please attach the following: 4 | 5 | - A screenshot of the issue. 6 | - The file used in the screenshot. If it's proprietary or too big, please try 7 | to reproduce the issue in a small sample file. 8 | - A link to your vimrc, if it exists. 9 | - The output of `vim --version`. 10 | 11 | These things make issues **much** easier to debug! 12 | 13 | **IMPORTANT** 14 | 15 | To make things easier on everyone, try to reproduce the issue with a minimal vim setup and an up-to-date 16 | checkout of vim-raku. Taking the time to help out with issues you have found makes things easier on all 17 | of us, and that's the whole reason this is an open project. =) 18 | 19 | Also, before you report something as a bug, please make sure you're using the latest version of 20 | vim-raku from Git. If you're using an older version, chances are that you're stumbling on a bug that 21 | someone else has in the past. 22 | 23 | If you have read and understand these guidelines, add the text "I have read the guidelines" in your issue 24 | when you create it. 25 | 26 | # Helping Out 27 | 28 | If you would like to contribute to vim-raku, please be aware that we have a test suite which can 29 | be run using the `prove` command. After you've made your changes, run the test suite via `prove`. 30 | The tests test a host of known situations for consistency, as well as verifies that vim-raku still 31 | highlights and folds code the way it does with the latest code on GitHub. Most fixes don't change highlighting, 32 | so the regression test should pass. If it fails, open the file(s) printed and make sure that their highlighting 33 | still makes sense. If it does, note that in your pull request and a maintainer will update the regression corpus 34 | data when he/she merges it. 35 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Description of issue 2 | 3 | Your description here! 4 | 5 | If your bug is not related to highlighting or folding, please feel free 6 | to delete the text below. 7 | 8 | # Screenshot of the issue: 9 | 10 | ![Screenshot](...) 11 | 12 | # Sample code: 13 | 14 | ```perl6 15 | ``` 16 | 17 | # Link to vimrc 18 | 19 | [vimrc](...) 20 | 21 | # Output of `vim --version` 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Raku community 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vim-raku 2 | Improved support for Raku in Vim. 3 | 4 | ## Installation 5 | 6 | Once installed, all files ending in `.raku`, `.rakumod`, `.rakudoc`, 7 | and `.rakutest` (and also `.pl6`, `.pm6`, `.p6`, and `.t6` for legacy 8 | purposes) will make use of the plugin's features. 9 | 10 | ### With a plugin manager 11 | 12 | Installation of this plugin can be done via any of the available plugin 13 | managers, such as [Pathogen][pathogen], [vim-plug][vim-plug], [vundle][vundle] 14 | or any other one. 15 | 16 | ### Using Vim's built-in package management 17 | 18 | Clone this repository in vim autoload packages directory: 19 | ```bash 20 | $ # installation 21 | $ git clone https://github.com/Raku/vim-raku.git ~/.vim/pack/vim-raku-pack/start/vim-raku 22 | 23 | $ # testing 24 | $ vim /tmp/example.raku +'syntax' +'q' 25 | ``` 26 | 27 | For more details follow those instructions: 28 | ```bash 29 | $ vim +'help packages' +'only' 30 | ``` 31 | 32 | ## Configuring optional features 33 | Not all features are enabled by default. This is in part due to them still 34 | being considered in testing, or because they may influence your regular 35 | workflow too much. These can be enabled by setting a certain variable to a 36 | truthy value. 37 | 38 | ### Unicode ops 39 | `vim-raku` can use Vim's abbreviation feature to convert ASCII based operators 40 | to their Unicode equivalents on the fly. To enable this feature, add the 41 | following line to your `vimrc` file: 42 | 43 | ```vim 44 | let g:raku_unicode_abbrevs = 1 45 | ``` 46 | 47 | [pathogen]: https://github.com/tpope/vim-pathogen 48 | [vim-plug]: https://github.com/junegunn/vim-plug 49 | [vundle]: https://github.com/gmarik/Vundle.vim 50 | 51 | ## License 52 | 53 | This project is available under the [MIT License](LICENSE.md). 54 | -------------------------------------------------------------------------------- /doc/vim-raku.txt: -------------------------------------------------------------------------------- 1 | *vim-raku.txt* The Raku programming language filetype 2 | 3 | *vim-raku* 4 | 5 | Vim-raku provides syntax highlighting, indentation, and other support for 6 | editing Raku programs. 7 | 8 | 1. Using Unicode in your Raku files |raku-unicode| 9 | 10 | ============================================================================== 11 | 1. Using Unicode in your Raku files *raku-unicode* 12 | 13 | Defining new operators using Unicode symbols is a good way to make your 14 | Raku program easy to read. See: 15 | https://perl6advent.wordpress.com/2012/12/18/day-18-formulas-resistance-is-futile/ 16 | 17 | While Raku does define ASCII alternatives for some common operators (see 18 | https://docs.raku.org/language/unicode_ascii), using the full range of 19 | Unicode operators is highly desirable. Your operating system provides input 20 | facilities, but using the features built in to Vim may be preferable. 21 | 22 | The natural way to produce these symbols in Vim is to use digraph shortcuts 23 | (:help |digraphs-use|). Many of them are defined; type `:digraphs` to get 24 | the list. A convenient way to read the list of digraphs is to save them in a 25 | file. From the shell: > 26 | vim +'redir >/tmp/vim-digraphs-listing.txt' +digraphs +'redir END' +q 27 | 28 | Some of them are available with standard Vim digraphs: 29 | << « /0 ∅ !< ≮ ~ 30 | >> » Ob ∘ !> ≯ ~ 31 | ., … 00 ∞ (C ⊂ ~ 32 | (U ∩ -: ÷ )C ⊃ ~ 33 | )U ∪ (_ ⊆ >= ≥ ~ 34 | ?= ≅ )_ ⊇ =< ≤ ~ 35 | (- ∈ ?= ≅ != ≠ ~ 36 | -) ∋ ?- ≃ ~ 37 | 38 | The Greek alphabet is available with '*' followed by a similar Latin symbol: 39 | *p π ~ 40 | *t τ ~ 41 | *X × ~ 42 | 43 | Numbers, subscripts and superscripts are available with 's' and 'S': 44 | 0s ₀ 0S ⁰ ~ 45 | 1s ₁ 1S ¹ ~ 46 | 2s ₂ 9S ⁹ ~ 47 | 48 | But some don´t come defined by default. Those are digraph definitions you can 49 | add in your ~/.vimrc file. > 50 | exec 'digraph \\ '.char2nr('∖') 51 | exec 'digraph \< '.char2nr('≼') 52 | exec 'digraph \> '.char2nr('≽') 53 | exec 'digraph (L '.char2nr('⊈') 54 | exec 'digraph )L '.char2nr('⊉') 55 | exec 'digraph (/ '.char2nr('⊄') 56 | exec 'digraph )/ '.char2nr('⊅') 57 | exec 'digraph )/ '.char2nr('⊅') 58 | exec 'digraph U+ '.char2nr('⊎') 59 | exec 'digraph 0- '.char2nr('⊖') 60 | " Euler's constant 61 | exec 'digraph ne '.char2nr('𝑒') 62 | " Raku's atomic operations marker 63 | exec 'digraph @@ '.char2nr('⚛') 64 | 65 | Alternatively, you can write Insert mode abbreviations that convert ASCII- 66 | based operators into their single-character Unicode equivalent. > 67 | iabbrev !(<) ⊄ 68 | iabbrev !(<=) ⊈ 69 | iabbrev !(>) ⊅ 70 | iabbrev !(>=) ⊉ 71 | iabbrev !(cont) ∌ 72 | iabbrev !(elem) ∉ 73 | iabbrev != ≠ 74 | iabbrev (&) ∩ 75 | iabbrev (+) ⊎ 76 | iabbrev (-) ∖ 77 | iabbrev (.) ⊍ 78 | iabbrev (<) ⊂ 79 | iabbrev (<+) ≼ 80 | iabbrev (<=) ⊆ 81 | iabbrev (>) ⊃ 82 | iabbrev (>+) ≽ 83 | iabbrev (>=) ⊇ 84 | iabbrev (\|) ∪ 85 | iabbrev (^) ⊖ 86 | iabbrev (atomic) ⚛ 87 | iabbrev (cont) ∋ 88 | iabbrev (elem) ∈ 89 | iabbrev * × 90 | iabbrev **0 ⁰ 91 | iabbrev **1 ¹ 92 | iabbrev **2 ² 93 | iabbrev **3 ³ 94 | iabbrev **4 ⁴ 95 | iabbrev **5 ⁵ 96 | iabbrev **6 ⁶ 97 | iabbrev **7 ⁷ 98 | iabbrev **8 ⁸ 99 | iabbrev **9 ⁹ 100 | iabbrev ... … 101 | iabbrev / ÷ 102 | iabbrev << « 103 | iabbrev <<[=]<< «=« 104 | iabbrev <<[=]>> «=» 105 | iabbrev <= ≤ 106 | iabbrev =~= ≅ 107 | iabbrev >= ≥ 108 | iabbrev >> » 109 | iabbrev >>[=]<< »=« 110 | iabbrev >>[=]>> »=» 111 | iabbrev Inf ∞ 112 | iabbrev atomic-add-fetch ⚛+= 113 | iabbrev atomic-assign ⚛= 114 | iabbrev atomic-fetch ⚛ 115 | iabbrev atomic-dec-fetch --⚛ 116 | iabbrev atomic-fetch-dec ⚛-- 117 | iabbrev atomic-fetch-inc ⚛++ 118 | iabbrev atomic-inc-fetch ++⚛ 119 | iabbrev atomic-sub-fetch ⚛−= 120 | iabbrev e 𝑒 121 | iabbrev o ∘ 122 | iabbrev pi π 123 | iabbrev set() ∅ 124 | iabbrev tau τ 125 | < 126 | vim:tw=78:ts=8:noet:ft=help:norl: 127 | -------------------------------------------------------------------------------- /ftdetect/raku.vim: -------------------------------------------------------------------------------- 1 | " whenever a named file is created, writen or read, 2 | " set raku filetype if the extension is one of those: 3 | " https://github.com/Raku/problem-solving/blob/master/solutions/language/Path-to-Raku.md#extensions 4 | 5 | autocmd BufNewFile,BufWritePost,BufReadPost 6 | \ *.pm6,*.p6,*.t6,*.pod6,*.raku,*.rakumod,*.rakudoc,*.rakutest 7 | \ set filetype=raku 8 | 9 | " whenever a named file is written or read, 10 | " set raku filetype if there is a shebang with raku in it 11 | 12 | autocmd BufWritePost,BufReadPost * 13 | \ if getline(1) =~ '^#!.*raku' | 14 | \ setf raku | 15 | \ endif 16 | 17 | -------------------------------------------------------------------------------- /ftplugin/raku.vim: -------------------------------------------------------------------------------- 1 | " Vim filetype plugin file 2 | " Language: Raku 3 | " Maintainer: vim-perl 4 | " Homepage: https://github.com/vim-perl/vim-perl6 5 | " Bugs/requests: https://github.com/vim-perl/vim-perl6/issues 6 | " Last Change: {{LAST_CHANGE}} 7 | " Contributors: Hinrik Örn Sigurðsson 8 | " 9 | " Based on ftplugin/perl.vim by Dan Sharp 10 | 11 | if exists("b:did_ftplugin") | finish | endif 12 | let b:did_ftplugin = 1 13 | 14 | " Make sure the continuation lines below do not cause problems in 15 | " compatibility mode. 16 | let s:save_cpo = &cpo 17 | set cpo-=C 18 | 19 | setlocal formatoptions-=t 20 | setlocal formatoptions+=crqol 21 | setlocal keywordprg=p6doc 22 | 23 | setlocal comments=:#\|,:#=,:# 24 | setlocal commentstring=#%s 25 | 26 | " Provided by Ned Konz 27 | "--------------------------------------------- 28 | setlocal include=\\<\\(use\\\|require\\)\\> 29 | setlocal includeexpr=substitute(v:fname,'::','/','g') 30 | setlocal suffixesadd=.rakumod,.rakudoc,.pm6,.pm 31 | setlocal define=[^A-Za-z_] 32 | 33 | " The following line changes a global variable but is necessary to make 34 | " gf and similar commands work. Thanks to Andrew Pimlott for pointing out 35 | " the problem. If this causes a " problem for you, add an 36 | " after/ftplugin/raku.vim file that contains 37 | " set isfname-=: 38 | set isfname+=: 39 | setlocal iskeyword=@,48-57,_,192-255,- 40 | 41 | " Raku exposes its CompUnits through $*REPO, but mapping module names to 42 | " compunit paths is nontrivial. Probably it's more convenient to rely on 43 | " people using zef, which has a handy store of sources for modules it has 44 | " installed. 45 | func s:compareReverseFtime(a, b) 46 | let atime = getftime(a:a) 47 | let btime = getftime(a:b) 48 | return atime > btime ? -1 : atime == btime ? 0 : 1 49 | endfunc 50 | 51 | let &l:path = "lib,." 52 | if exists('$RAKULIB') 53 | let &l:path = &l:path . "," . $RAKULIB 54 | endif 55 | let &l:path = &l:path . "," . join( 56 | \ sort(glob("~/.zef/store/*/*/lib", 0, 1), "s:compareReverseFtime"), 57 | \ ',') 58 | 59 | " Convert ascii-based ops into their single-character unicode equivalent 60 | if get(g:, 'raku_unicode_abbrevs', 0) 61 | iabbrev !(<) ⊄ 62 | iabbrev !(<=) ⊈ 63 | iabbrev !(>) ⊅ 64 | iabbrev !(>=) ⊉ 65 | iabbrev !(cont) ∌ 66 | iabbrev !(elem) ∉ 67 | iabbrev != ≠ 68 | iabbrev (&) ∩ 69 | iabbrev (+) ⊎ 70 | iabbrev (-) ∖ 71 | iabbrev (.) ⊍ 72 | iabbrev (<) ⊂ 73 | iabbrev (<+) ≼ 74 | iabbrev (<=) ⊆ 75 | iabbrev (>) ⊃ 76 | iabbrev (>+) ≽ 77 | iabbrev (>=) ⊇ 78 | iabbrev (\|) ∪ 79 | iabbrev (^) ⊖ 80 | iabbrev (atomic) ⚛ 81 | iabbrev (cont) ∋ 82 | iabbrev (elem) ∈ 83 | iabbrev * × 84 | iabbrev **0 ⁰ 85 | iabbrev **1 ¹ 86 | iabbrev **2 ² 87 | iabbrev **3 ³ 88 | iabbrev **4 ⁴ 89 | iabbrev **5 ⁵ 90 | iabbrev **6 ⁶ 91 | iabbrev **7 ⁷ 92 | iabbrev **8 ⁸ 93 | iabbrev **9 ⁹ 94 | iabbrev ... … 95 | iabbrev / ÷ 96 | iabbrev << « 97 | iabbrev <<[=]<< «=« 98 | iabbrev <<[=]>> «=» 99 | iabbrev <= ≤ 100 | iabbrev =~= ≅ 101 | iabbrev >= ≥ 102 | iabbrev >> » 103 | iabbrev >>[=]<< »=« 104 | iabbrev >>[=]>> »=» 105 | iabbrev Inf ∞ 106 | iabbrev atomic-add-fetch ⚛+= 107 | iabbrev atomic-assign ⚛= 108 | iabbrev atomic-fetch ⚛ 109 | iabbrev atomic-dec-fetch --⚛ 110 | iabbrev atomic-fetch-dec ⚛-- 111 | iabbrev atomic-fetch-inc ⚛++ 112 | iabbrev atomic-inc-fetch ++⚛ 113 | iabbrev atomic-sub-fetch ⚛−= 114 | iabbrev e 𝑒 115 | iabbrev o ∘ 116 | iabbrev pi π 117 | iabbrev set() ∅ 118 | iabbrev tau τ 119 | endif 120 | 121 | " Undo the stuff we changed. 122 | let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< isk< kp< path<" . 123 | \ " | unlet! b:browsefilter" 124 | 125 | " Restore the saved compatibility options. 126 | let &cpo = s:save_cpo 127 | unlet s:save_cpo 128 | -------------------------------------------------------------------------------- /indent/raku.vim: -------------------------------------------------------------------------------- 1 | " Vim indent file 2 | " Language: Raku 3 | " Maintainer: vim-perl 4 | " Homepage: https://github.com/vim-perl/vim-perl6 5 | " Bugs/requests: https://github.com/vim-perl/vim-perl6/issues 6 | " Last Change: {{LAST_CHANGE}} 7 | " Contributors: Andy Lester 8 | " Hinrik Örn Sigurðsson 9 | " 10 | " Adapted from indent/perl.vim by Rafael Garcia-Suarez 11 | 12 | " Suggestions and improvements by : 13 | " Aaron J. Sherman (use syntax for hints) 14 | " Artem Chuprina (play nice with folding) 15 | " TODO: 16 | " This file still relies on stuff from the Perl 5 syntax file, which Perl 6 17 | " does not use. 18 | " 19 | " Things that are not or not properly indented (yet) : 20 | " - Continued statements 21 | " print "foo", 22 | " "bar"; 23 | " print "foo" 24 | " if bar(); 25 | " - Multiline regular expressions (m//x) 26 | " (The following probably needs modifying the perl syntax file) 27 | " - qw() lists 28 | " - Heredocs with terminators that don't match \I\i* 29 | 30 | " Only load this indent file when no other was loaded. 31 | if exists("b:did_indent") 32 | finish 33 | endif 34 | let b:did_indent = 1 35 | 36 | " Is syntax highlighting active ? 37 | let b:indent_use_syntax = has("syntax") 38 | 39 | setlocal indentexpr=GetRakuIndent() 40 | 41 | " we reset it first because the Perl 5 indent file might have been loaded due 42 | " to a .pl/pm file extension, and indent files don't clean up afterwards 43 | setlocal indentkeys& 44 | 45 | setlocal indentkeys+=0=,0),0],0>,0»,0=or,0=and 46 | if !b:indent_use_syntax 47 | setlocal indentkeys+=0=EO 48 | endif 49 | 50 | let s:cpo_save = &cpo 51 | set cpo-=C 52 | 53 | function! GetRakuIndent() 54 | 55 | " Get the line to be indented 56 | let cline = getline(v:lnum) 57 | 58 | " Indent POD markers to column 0 59 | if cline =~ '^\s*=\L\@!' 60 | return 0 61 | endif 62 | 63 | " Get current syntax item at the line's first char 64 | let csynid = '' 65 | if b:indent_use_syntax 66 | let csynid = synIDattr(synID(v:lnum,1,0),"name") 67 | endif 68 | 69 | " Don't reindent POD and heredocs 70 | if csynid =~ "^rakuPod" 71 | return indent(v:lnum) 72 | endif 73 | 74 | 75 | " Now get the indent of the previous perl line. 76 | 77 | " Find a non-blank line above the current line. 78 | let lnum = prevnonblank(v:lnum - 1) 79 | " Hit the start of the file, use zero indent. 80 | if lnum == 0 81 | return 0 82 | endif 83 | let line = getline(lnum) 84 | let ind = indent(lnum) 85 | " Skip heredocs, POD, and comments on 1st column 86 | if b:indent_use_syntax 87 | let skippin = 2 88 | while skippin 89 | let synid = synIDattr(synID(lnum,1,0),"name") 90 | if (synid =~ "^rakuPod" || synid =~ "rakuComment") 91 | let lnum = prevnonblank(lnum - 1) 92 | if lnum == 0 93 | return 0 94 | endif 95 | let line = getline(lnum) 96 | let ind = indent(lnum) 97 | let skippin = 1 98 | else 99 | let skippin = 0 100 | endif 101 | endwhile 102 | endif 103 | 104 | if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$' 105 | let ind = ind + &sw 106 | endif 107 | if cline =~ '^\s*[)}\]»>]' 108 | let ind = ind - &sw 109 | endif 110 | 111 | " Indent lines that begin with 'or' or 'and' 112 | if cline =~ '^\s*\(or\|and\)\>' 113 | if line !~ '^\s*\(or\|and\)\>' 114 | let ind = ind + &sw 115 | endif 116 | elseif line =~ '^\s*\(or\|and\)\>' 117 | let ind = ind - &sw 118 | endif 119 | 120 | return ind 121 | 122 | endfunction 123 | 124 | let &cpo = s:cpo_save 125 | unlet s:cpo_save 126 | 127 | " vim:ts=8:sts=4:sw=4:expandtab:ft=vim 128 | -------------------------------------------------------------------------------- /syntax/raku.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Raku 3 | " Maintainer: vim-perl 4 | " Homepage: https://github.com/vim-perl/vim-perl6 5 | " Bugs/requests: https://github.com/vim-perl/vim-perl6/issues 6 | " Last Change: {{LAST_CHANGE}} 7 | 8 | " Contributors: Luke Palmer 9 | " Moritz Lenz 10 | " Hinrik Örn Sigurðsson 11 | " 12 | " This is a big undertaking. 13 | " 14 | " The ftdetect/raku.vim file in this repository takes care of setting the 15 | " right filetype for Raku files. To set it explicitly you can also add this 16 | " line near the bottom of your source file: 17 | " # vim: filetype=raku 18 | 19 | " TODO: 20 | " * Go over the list of keywords/types to see what's deprecated/missing 21 | " * Add more support for folding (:help syn-fold) 22 | " 23 | " If you want to have Pir code inside Q:PIR// strings highlighted, do: 24 | " let raku_embedded_pir=1 25 | " 26 | " The above requires pir.vim, which you can find in Parrot's repository: 27 | " https://github.com/parrot/parrot/tree/master/editor 28 | " 29 | " To highlight Perl 5 regexes (m:P5//): 30 | " let raku_perl5_regexes=1 31 | " 32 | " To enable folding: 33 | " let raku_fold=1 34 | 35 | if version < 704 | throw "raku.vim uses regex syntax which Vim <7.4 doesn't support. Try 'make fix_old_vim' in the vim-perl repository." | endif 36 | 37 | " For version 5.x: Clear all syntax items 38 | " For version 6.x: Quit when a syntax file was already loaded 39 | if version < 600 40 | syntax clear 41 | elseif exists("b:current_syntax") 42 | finish 43 | endif 44 | let s:keepcpo= &cpo 45 | set cpo&vim 46 | 47 | " Patterns which will be interpolated by the preprocessor (tools/preproc.pl): 48 | " 49 | " @@IDENT_NONDIGIT@@ "[A-Za-z_\xC0-\xFF]" 50 | " @@IDENT_CHAR@@ "[A-Za-z_\xC0-\xFF0-9]" 51 | " @@IDENTIFIER@@ "\%(@@IDENT_NONDIGIT@@\%(@@IDENT_CHAR@@\|[-']@@IDENT_NONDIGIT@@\@=\)*\)" 52 | " @@IDENTIFIER_START@@ "@@IDENT_CHAR@@\@1". 146 | syn match rakuKeywordStart display "\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!\)\@=[A-Za-z_\xC0-\xFF0-9]\@1" nextgroup=rakuDeclare,rakuIdentifier skipwhite skipempty 163 | syn match rakuDeclare display "[.^]\@1" nextgroup=rakuIdentifier skipwhite skipempty 164 | syn match rakuDeclareRegex display "[.^]\@1" nextgroup=rakuRegexName skipwhite skipempty 165 | 166 | syn match rakuTypeConstraint display "\%([.^]\|^\s*\)\@" 167 | syn match rakuTypeConstraint display "\%([.^]\|^\s*\)\@».;\\∈∉∋∌∩∪≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖∅∘]" 184 | syn match rakuOperator display "\%(:\@1][=+]\?\|cont\|elem\))" 193 | 194 | " Reverse, cross, and zip metaoperators 195 | exec "syn match rakuRSXZOp display \"[RSXZ]:\\@!\\%(\\a\\@=\\%(". s:alpha_metaops_or . "\\)\\>\\|[[:alnum:]]\\@!\\%([.,]\\|[^[,.[:alnum:][:space:]]\\)\\+\\|\\s\\@=\\|$\\)\"" 196 | 197 | syn match rakuBlockLabel display "^\s*\zs\h\w*\s*::\@!\_s\@=" 198 | 199 | syn match rakuNumber display "[A-Za-z_\xC0-\xFF0-9]\@1" 215 | syn match rakuContext display "\%(\$\|@\|%\|&\)(\@=" 216 | 217 | " Quoting 218 | 219 | " one cluster for every quote adverb 220 | syn cluster rakuInterp_scalar 221 | \ add=rakuInterpScalar 222 | 223 | syn cluster rakuInterp_array 224 | \ add=rakuInterpArray 225 | 226 | syn cluster rakuInterp_hash 227 | \ add=rakuInterpHash 228 | 229 | syn cluster rakuInterp_function 230 | \ add=rakuInterpFunction 231 | 232 | syn cluster rakuInterp_closure 233 | \ add=rakuInterpClosure 234 | 235 | syn cluster rakuInterp_q 236 | \ add=rakuEscQQ 237 | \ add=rakuEscBackSlash 238 | 239 | syn cluster rakuInterp_backslash 240 | \ add=@rakuInterp_q 241 | \ add=rakuEscape 242 | \ add=rakuEscOpenCurly 243 | \ add=rakuEscCodePoint 244 | \ add=rakuEscHex 245 | \ add=rakuEscOct 246 | \ add=rakuEscOctOld 247 | \ add=rakuEscNull 248 | 249 | syn cluster rakuInterp_qq 250 | \ add=@rakuInterp_scalar 251 | \ add=@rakuInterp_array 252 | \ add=@rakuInterp_hash 253 | \ add=@rakuInterp_function 254 | \ add=@rakuInterp_closure 255 | \ add=@rakuInterp_backslash 256 | \ add=rakuMatchVarSigil 257 | 258 | syn region rakuInterpScalar 259 | \ start="\ze\z(\$\%(\%(\%(\d\+\|!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" 260 | \ start="\ze\z(\$\%(\%(\%(\%([.^*?=!~]\|:\@1]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" 275 | \ end="\z1\zs" 276 | \ contained keepend 277 | \ contains=TOP 278 | 279 | syn region rakuInterpArray 280 | \ matchgroup=rakuContext 281 | \ start="@\ze()\@!" 282 | \ skip="([^)]*)" 283 | \ end=")\zs" 284 | \ contained 285 | \ contains=TOP 286 | 287 | syn region rakuInterpHash 288 | \ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" 289 | \ end="\z1\zs" 290 | \ contained keepend 291 | \ contains=TOP 292 | 293 | syn region rakuInterpHash 294 | \ matchgroup=rakuContext 295 | \ start="%\ze()\@!" 296 | \ skip="([^)]*)" 297 | \ end=")\zs" 298 | \ contained 299 | \ contains=TOP 300 | 301 | syn region rakuInterpFunction 302 | \ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" 303 | \ end="\z1\zs" 304 | \ contained keepend 305 | \ contains=TOP 306 | 307 | syn region rakuInterpFunction 308 | \ matchgroup=rakuContext 309 | \ start="&\ze()\@!" 310 | \ skip="([^)]*)" 311 | \ end=")\zs" 312 | \ contained 313 | \ contains=TOP 314 | 315 | syn region rakuInterpClosure 316 | \ start="\\\@1" contained 329 | syn match rakuEscCloseFrench display "\\»" contained 330 | syn match rakuEscBackTick display "\\`" contained 331 | syn match rakuEscForwardSlash display "\\/" contained 332 | syn match rakuEscVerticalBar display "\\|" contained 333 | syn match rakuEscExclamation display "\\!" contained 334 | syn match rakuEscComma display "\\," contained 335 | syn match rakuEscDollar display "\\\$" contained 336 | syn match rakuEscCloseCurly display "\\}" contained 337 | syn match rakuEscCloseBracket display "\\\]" contained 338 | 339 | " matches :key, :!key, :$var, :key, etc 340 | " Since we don't know in advance how the adverb ends, we use a trick. 341 | " Consume nothing with the start pattern (\ze at the beginning), 342 | " while capturing the whole adverb into \z1 and then putting it before 343 | " the match start (\zs) of the end pattern. 344 | syn region rakuAdverb 345 | \ start="\ze\z(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)" 346 | \ start="\ze\z(:!\?[@$%]\$*\%(::\|\%(\$\@1<=\d\+\|!\|/\|¢\)\|\%(\%([.^*?=!~]\|:\@1 352 | " Distinguishing this from the "less than" operator is tricky. For now, 353 | " it matches if any of the following is true: 354 | " 355 | " * There is whitespace missing on either side of the "<", since 356 | " people tend to put spaces around "less than". We make an exception 357 | " for " = < ... >" assignments though. 358 | " * It comes after "enum", "for", "any", "all", or "none" 359 | " * It's the first or last thing on a line (ignoring whitespace) 360 | " * It's preceded by "(\s*" or "=\s\+" 361 | " * It's empty and terminated on the same line (e.g. <> and < >) 362 | " 363 | " It never matches when: 364 | " 365 | " * Preceded by [<+~=!] (e.g. <>, =<$foo>, * !< 3) 366 | " * Followed by [-=] (e.g. <--, <=, <==, <->) 367 | syn region rakuStringAngle 368 | \ matchgroup=rakuQuote 369 | \ start="\%(\<\%(enum\|for\|any\|all\|none\)\>\s*(\?\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" 370 | \ start="\%(\s\|[<+~=!]\)\@\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" 371 | \ start="[<+~=!]\@1\|\%([=-]\{1,2}>\|[=-]\{1,2}\)\)\@!" 372 | \ start="\%(^\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" 373 | \ start="[<+~=!]\@1\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" 375 | \ start="<\%(\s*>\)\@=" 376 | \ skip="\\\@1" 377 | \ end=">" 378 | \ contains=rakuInnerAnglesOne,rakuEscBackSlash,rakuEscCloseAngle 379 | 380 | syn region rakuStringAngleFixed 381 | \ matchgroup=rakuQuote 382 | \ start="<" 383 | \ skip="\\\@1" 384 | \ end=">" 385 | \ contains=rakuInnerAnglesOne,rakuEscBackSlash,rakuEscCloseAngle 386 | \ contained 387 | 388 | syn region rakuInnerAnglesOne 389 | \ matchgroup=rakuStringAngle 390 | \ start="\\\@1" 392 | \ end=">" 393 | \ transparent contained 394 | \ contains=rakuInnerAnglesOne 395 | 396 | " <> 397 | syn region rakuStringAngles 398 | \ matchgroup=rakuQuote 399 | \ start="<<=\@!" 400 | \ skip="\\\@1" 401 | \ end=">>" 402 | \ contains=rakuInnerAnglesTwo,@rakuInterp_qq,rakuComment,rakuBracketComment,rakuEscHash,rakuEscCloseAngle,rakuAdverb,rakuStringSQ,rakuStringDQ 403 | 404 | syn region rakuInnerAnglesTwo 405 | \ matchgroup=rakuStringAngles 406 | \ start="<<" 407 | \ skip="\\\@1" 408 | \ end=">>" 409 | \ transparent contained 410 | \ contains=rakuInnerAnglesTwo 411 | 412 | " «words» 413 | syn region rakuStringFrench 414 | \ matchgroup=rakuQuote 415 | \ start="«" 416 | \ skip="\\\@1" and "«»" strings in order to override 429 | " them, but before other types of strings, to avoid matching those delimiters 430 | " as parts of hyperops. 431 | syn match rakuHyperOp display #[^[:digit:][{('",:[:space:]][^[{('",:[:space:]]*\%(«\|<<\)# 432 | syn match rakuHyperOp display "«\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+[«»]" 433 | syn match rakuHyperOp display "»\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(«\|»\?\)" 434 | syn match rakuHyperOp display "<<\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(<<\|>>\)" 435 | syn match rakuHyperOp display ">>\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(<<\|\%(>>\)\?\)" 436 | 437 | " 'string' 438 | syn region rakuStringSQ 439 | \ matchgroup=rakuQuote 440 | \ start="'" 441 | \ skip="\\\@1", "rakuEscCloseAngle", "\\%(\\\\\\@1\\|<[^>]*>\\)"], 495 | \ ["French", "«", "»", "rakuEscCloseFrench", "\\%(\\\\\\@1, @ 607 | syn region rakuMatchVarSigil 608 | \ matchgroup=rakuVariable 609 | \ start="[$@]\%(<<\@!\)\@=" 610 | \ end=">\@1<=" 611 | \ contains=rakuMatchVar 612 | 613 | syn region rakuMatchVar 614 | \ matchgroup=rakuTwigil 615 | \ start="<" 616 | \ end=">" 617 | \ contained 618 | 619 | syn region rakuRxClosure 620 | \ matchgroup=rakuNormal 621 | \ start="{" 622 | \ end="}" 623 | \ contained 624 | \ containedin=rakuRxClosure 625 | \ contains=TOP 626 | syn region rakuRxGroup 627 | \ matchgroup=rakuStringSpecial2 628 | \ start="\[" 629 | \ end="]" 630 | \ contained 631 | \ contains=@rakuRegexen,@rakuVariables,rakuMatchVarSigil 632 | syn region rakuRxAssertion 633 | \ matchgroup=rakuStringSpecial2 634 | \ start="<\%(?\?\%(before\|after\)\|\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)=\)\|[+?*]\)\?" 635 | \ end=">" 636 | \ contained 637 | \ contains=@rakuRegexen,rakuIdentifier,@rakuVariables,rakuRxCharClass,rakuRxAssertCall 638 | syn region rakuRxAssertGroup 639 | \ matchgroup=rakuStringSpecial2 640 | \ start="<\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)=\[" 641 | \ skip="\\\@1" 653 | \ contained keepend 654 | \ contains=TOP 655 | syn match rakuRxBoundary display contained "\%([«»]\|<<\|>>\)" 656 | syn region rakuRxCharClass 657 | \ matchgroup=rakuStringSpecial2 658 | \ start="\%(<[-!+?]\?\)\@2<=\[" 659 | \ skip="\\]" 660 | \ end="]" 661 | \ contained 662 | \ contains=rakuRxRange,rakuRxEscape,rakuEscHex,rakuEscOct,rakuEscCodePoint,rakuEscNull 663 | syn region rakuRxQuoteWords 664 | \ matchgroup=rakuStringSpecial2 665 | \ start="<\s" 666 | \ end="\s\?>" 667 | \ contained 668 | syn region rakuRxAdverb 669 | \ start="\ze\z(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)" 670 | \ end="\z1\zs" 671 | \ contained keepend 672 | \ contains=TOP 673 | syn region rakuRxAdverbArg 674 | \ start="\%(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\@<=(" 675 | \ skip="([^)]\{-})" 676 | \ end=")" 677 | \ contained 678 | \ keepend 679 | \ contains=TOP 680 | syn region rakuRxStorage 681 | \ matchgroup=rakuOperator 682 | \ start="\%(^\s*\)\@<=:\%(my\>\|temp\>\)\@=" 683 | \ end="$" 684 | \ contains=TOP 685 | \ contained 686 | \ keepend 687 | 688 | " 'string' inside a regex 689 | syn region rakuRxStringSQ 690 | \ matchgroup=rakuQuote 691 | \ start="'" 692 | \ skip="\\\@1\)\)\@=" 717 | syn match rakuVarSlash display "\$/" 718 | syn match rakuVarExclam display "\$!" 719 | syn match rakuVarMatch display "\$¢" 720 | syn match rakuVarNum display "\$\d\+" 721 | syn match rakuVariable display "self" 722 | syn match rakuVariable display "[@$%&]\?[@&$%]\$*\%(::\|\%(\%([.^*?=!~]\|:\@1>\)" contained 726 | syn match rakuTwigil display "\%([.^*?=!~]\|:\@1\|\<\%(if\|unless\|while\|when\|where\|so\)\)\s*\)\@<=/[/=]\@!" 742 | \ skip="\\/" 743 | \ end="/" 744 | \ contains=@rakuRegexen,rakuVariable,rakuVarExclam,rakuVarMatch,rakuVarNum 745 | 746 | " m/foo/, m$foo$, m!foo!, etc 747 | syn region rakuMatch 748 | \ matchgroup=rakuQuote 749 | \ start=+\z([/!$,|`"]\)+ 750 | \ skip="\\\z1" 751 | \ end="\z1" 752 | \ contained 753 | \ contains=@rakuRegexen,rakuVariable,rakuVarNum 754 | 755 | " m, m«foo», m{foo}, etc 756 | for [s:name, s:start_delim, s:end_delim, s:end_group, s:skip] in s:bracketing_delims 757 | exec "syn region rakuMatch matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=@rakuRegexen,@rakuVariables" 758 | endfor 759 | unlet s:name s:start_delim s:end_delim s:end_group s:skip 760 | 761 | " Substitutions 762 | 763 | " s/foo//, s$foo$$, s!foo!!, etc 764 | syn region rakuSubstitution 765 | \ matchgroup=rakuQuote 766 | \ start=+\z([/!$,|`"]\)+ 767 | \ skip="\\\z1" 768 | \ end="\z1"me=e-1 769 | \ contained 770 | \ contains=@rakuRegexen,rakuVariable,rakuVarNum 771 | \ nextgroup=rakuReplacement 772 | 773 | syn region rakuReplacement 774 | \ matchgroup=rakuQuote 775 | \ start="\z(.\)" 776 | \ skip="\\\z1" 777 | \ end="\z1" 778 | \ contained 779 | \ contains=@rakuInterp_qq 780 | 781 | " s, s«foo»«bar», s{foo}{bar}, etc 782 | for [s:name, s:start_delim, s:end_delim, s:end_group, s:skip] in s:bracketing_delims 783 | exec "syn region rakuSubstitution matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=@rakuRegexen,@rakuVariables nextgroup=rakuRepl".s:name 784 | exec "syn region rakuRepl".s:name." matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=@rakuInterp_qq" 785 | endfor 786 | unlet s:name s:start_delim s:end_delim s:end_group s:skip 787 | 788 | " Transliteration 789 | 790 | " tr/foo/bar/, tr|foo|bar, etc 791 | syn region rakuTransliteration 792 | \ matchgroup=rakuQuote 793 | \ start=+\z([/!$,|`"]\)+ 794 | \ skip="\\\z1" 795 | \ end="\z1"me=e-1 796 | \ contained 797 | \ contains=rakuRxRange 798 | \ nextgroup=rakuTransRepl 799 | 800 | syn region rakuTransRepl 801 | \ matchgroup=rakuQuote 802 | \ start="\z(.\)" 803 | \ skip="\\\z1" 804 | \ end="\z1" 805 | \ contained 806 | \ contains=@rakuInterp_qq,rakuRxRange 807 | 808 | " tr, tr«foo»«bar», tr{foo}{bar}, etc 809 | for [s:name, s:start_delim, s:end_delim, s:end_group, s:skip] in s:bracketing_delims 810 | exec "syn region rakuTransliteration matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=rakuRxRange nextgroup=rakuTransRepl".s:name 811 | exec "syn region rakuTransRepl".s:name." matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=@rakuInterp_qq,rakuRxRange" 812 | endfor 813 | unlet s:name s:start_delim s:end_delim s:end_group s:skip s:bracketing_delims 814 | 815 | if exists("raku_perl5_regexes") || exists("raku_extended_all") 816 | 817 | " Perl 5 regex regions 818 | 819 | syn cluster rakuRegexP5Base 820 | \ add=rakuRxP5Escape 821 | \ add=rakuRxP5Oct 822 | \ add=rakuRxP5Hex 823 | \ add=rakuRxP5EscMeta 824 | \ add=rakuRxP5CodePoint 825 | \ add=rakuRxP5Prop 826 | 827 | " normal regex stuff 828 | syn cluster rakuRegexP5 829 | \ add=@rakuRegexP5Base 830 | \ add=rakuRxP5Quantifier 831 | \ add=rakuRxP5Meta 832 | \ add=rakuRxP5QuoteMeta 833 | \ add=rakuRxP5ParenMod 834 | \ add=rakuRxP5Verb 835 | \ add=rakuRxP5Count 836 | \ add=rakuRxP5Named 837 | \ add=rakuRxP5ReadRef 838 | \ add=rakuRxP5WriteRef 839 | \ add=rakuRxP5CharClass 840 | \ add=rakuRxP5Anchor 841 | 842 | " inside character classes 843 | syn cluster rakuRegexP5Class 844 | \ add=@rakuRegexP5Base 845 | \ add=rakuRxP5Posix 846 | \ add=rakuRxP5Range 847 | 848 | syn match rakuRxP5Escape display contained "\\\S" 849 | syn match rakuRxP5CodePoint display contained "\\c\S\@=" nextgroup=rakuRxP5CPId 850 | syn match rakuRxP5CPId display contained "\S" 851 | syn match rakuRxP5Oct display contained "\\\%(\o\{1,3}\)\@=" nextgroup=rakuRxP5OctSeq 852 | syn match rakuRxP5OctSeq display contained "\o\{1,3}" 853 | syn match rakuRxP5Anchor display contained "[\^$]" 854 | syn match rakuRxP5Hex display contained "\\x\%({\x\+}\|\x\{1,2}\)\@=" nextgroup=rakuRxP5HexSeq 855 | syn match rakuRxP5HexSeq display contained "\x\{1,2}" 856 | syn region rakuRxP5HexSeq 857 | \ matchgroup=rakuRxP5Escape 858 | \ start="{" 859 | \ end="}" 860 | \ contained 861 | syn region rakuRxP5Named 862 | \ matchgroup=rakuRxP5Escape 863 | \ start="\%(\\N\)\@2<={" 864 | \ end="}" 865 | \ contained 866 | syn match rakuRxP5Quantifier display contained "\%([+*]\|(\@1" 873 | \ contained 874 | syn match rakuRxP5WriteRef display contained "\\g\%(\d\|{\)\@=" nextgroup=rakuRxP5WriteRefId 875 | syn match rakuRxP5WriteRefId display contained "\d\+" 876 | syn region rakuRxP5WriteRefId 877 | \ matchgroup=rakuRxP5Escape 878 | \ start="{" 879 | \ end="}" 880 | \ contained 881 | syn match rakuRxP5Prop display contained "\\[pP]\%(\a\|{\)\@=" nextgroup=rakuRxP5PropId 882 | syn match rakuRxP5PropId display contained "\a" 883 | syn region rakuRxP5PropId 884 | \ matchgroup=rakuRxP5Escape 885 | \ start="{" 886 | \ end="}" 887 | \ contained 888 | syn match rakuRxP5Meta display contained "[(|).]" 889 | syn match rakuRxP5ParenMod display contained "(\@1<=?\@=" nextgroup=rakuRxP5Mod,rakuRxP5ModName,rakuRxP5Code 890 | syn match rakuRxP5Mod display contained "?\%(<\?=\|<\?!\|[#:|]\)" 891 | syn match rakuRxP5Mod display contained "?-\?[impsx]\+" 892 | syn match rakuRxP5Mod display contained "?\%([-+]\?\d\+\|R\)" 893 | syn match rakuRxP5Mod display contained "?(DEFINE)" 894 | syn match rakuRxP5Mod display contained "?\%(&\|P[>=]\)" nextgroup=rakuRxP5ModDef 895 | syn match rakuRxP5ModDef display contained "\h\w*" 896 | syn region rakuRxP5ModName 897 | \ matchgroup=rakuStringSpecial 898 | \ start="?'" 899 | \ end="'" 900 | \ contained 901 | syn region rakuRxP5ModName 902 | \ matchgroup=rakuStringSpecial 903 | \ start="?P\?<" 904 | \ end=">" 905 | \ contained 906 | syn region rakuRxP5Code 907 | \ matchgroup=rakuStringSpecial 908 | \ start="??\?{" 909 | \ end="})\@=" 910 | \ contained 911 | \ contains=TOP 912 | syn match rakuRxP5EscMeta display contained "\\[?*.{}()[\]|\^$]" 913 | syn match rakuRxP5Count display contained "\%({\d\+\%(,\%(\d\+\)\?\)\?}\)\@=" nextgroup=rakuRxP5CountId 914 | syn region rakuRxP5CountId 915 | \ matchgroup=rakuRxP5Escape 916 | \ start="{" 917 | \ end="}" 918 | \ contained 919 | syn match rakuRxP5Verb display contained "(\@1<=\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\?\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\?\|ACCEPT\)" 920 | syn region rakuRxP5QuoteMeta 921 | \ matchgroup=rakuRxP5Escape 922 | \ start="\\Q" 923 | \ end="\\E" 924 | \ contained 925 | \ contains=@rakuVariables,rakuEscBackSlash 926 | syn region rakuRxP5CharClass 927 | \ matchgroup=rakuStringSpecial 928 | \ start="\[\^\?" 929 | \ skip="\\]" 930 | \ end="]" 931 | \ contained 932 | \ contains=@rakuRegexP5Class 933 | syn region rakuRxP5Posix 934 | \ matchgroup=rakuRxP5Escape 935 | \ start="\[:" 936 | \ end=":]" 937 | \ contained 938 | syn match rakuRxP5Range display contained "-" 939 | 940 | " m:P5// 941 | syn region rakuMatch 942 | \ matchgroup=rakuQuote 943 | \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2 989 | syn region rakuMatch 990 | \ matchgroup=rakuQuote 991 | \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2\@!" 992 | \ skip="\\>" 993 | \ end=">" 994 | \ contains=@rakuRegexP5,rakuVariables 995 | 996 | " m:P5«» 997 | syn region rakuMatch 998 | \ matchgroup=rakuQuote 999 | \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2]*>" 1033 | \ end=">" 1034 | \ contains=rakuAttention,rakuBracketComment 1035 | syn region rakuBracketComment 1036 | \ start="#[`|=]«" 1037 | \ skip="«[^»]*»" 1038 | \ end="»" 1039 | \ contains=rakuAttention,rakuBracketComment 1040 | 1041 | " Comments with double and triple delimiters 1042 | syn region rakuBracketComment 1043 | \ matchgroup=rakuBracketComment 1044 | \ start="#[`|=]((" 1045 | \ skip="((\%([^)\|))\@!]\)*))" 1046 | \ end="))" 1047 | \ contains=rakuAttention,rakuBracketComment 1048 | syn region rakuBracketComment 1049 | \ matchgroup=rakuBracketComment 1050 | \ start="#[`|=](((" 1051 | \ skip="(((\%([^)]\|)\%())\)\@!\)*)))" 1052 | \ end=")))" 1053 | \ contains=rakuAttention,rakuBracketComment 1054 | 1055 | syn region rakuBracketComment 1056 | \ matchgroup=rakuBracketComment 1057 | \ start="#[`|=]\[\[" 1058 | \ skip="\[\[\%([^\]]\|]]\@!\)*]]" 1059 | \ end="]]" 1060 | \ contains=rakuAttention,rakuBracketComment 1061 | syn region rakuBracketComment 1062 | \ matchgroup=rakuBracketComment 1063 | \ start="#[`|=]\[\[\[" 1064 | \ skip="\[\[\[\%([^\]]\|]\%(]]\)\@!\)*]]]" 1065 | \ end="]]]" 1066 | \ contains=rakuAttention,rakuBracketComment 1067 | 1068 | syn region rakuBracketComment 1069 | \ matchgroup=rakuBracketComment 1070 | \ start="#[`|=]{{" 1071 | \ skip="{{\%([^}]\|}}\@!\)*}}" 1072 | \ end="}}" 1073 | \ contains=rakuAttention,rakuBracketComment 1074 | syn region rakuBracketComment 1075 | \ matchgroup=rakuBracketComment 1076 | \ start="#[`|=]{{{" 1077 | \ skip="{{{\%([^}]\|}\%(}}\)\@!\)*}}}" 1078 | \ end="}}}" 1079 | \ contains=rakuAttention,rakuBracketComment 1080 | 1081 | syn region rakuBracketComment 1082 | \ matchgroup=rakuBracketComment 1083 | \ start="#[`|=]<<" 1084 | \ skip="<<\%([^>]\|>>\@!\)*>>" 1085 | \ end=">>" 1086 | \ contains=rakuAttention,rakuBracketComment 1087 | syn region rakuBracketComment 1088 | \ matchgroup=rakuBracketComment 1089 | \ start="#[`|=]<<<" 1090 | \ skip="<<<\%([^>]\|>\%(>>\)\@!\)*>>>" 1091 | \ end=">>>" 1092 | \ contains=rakuAttention,rakuBracketComment 1093 | 1094 | syn region rakuBracketComment 1095 | \ matchgroup=rakuBracketComment 1096 | \ start="#[`|=]««" 1097 | \ skip="««\%([^»]\|»»\@!\)*»»" 1098 | \ end="»»" 1099 | \ contains=rakuAttention,rakuBracketComment 1100 | syn region rakuBracketComment 1101 | \ matchgroup=rakuBracketComment 1102 | \ start="#[`|=]«««" 1103 | \ skip="«««\%([^»]\|»\%(»»\)\@!\)*»»»" 1104 | \ end="»»»" 1105 | \ contains=rakuAttention,rakuBracketComment 1106 | 1107 | syn match rakuShebang display "\%^#!.*" 1108 | 1109 | " => autoquoting 1110 | syn match rakuStringAuto display "\.\@1" 1111 | syn match rakuStringAuto display "\.\@1" 1112 | syn match rakuStringAuto display "\.\@1" 1113 | 1114 | " Pod 1115 | 1116 | " Abbreviated blocks (implicit code forbidden) 1117 | syn region rakuPodAbbrRegion 1118 | \ matchgroup=rakuPodPrefix 1119 | \ start="^\s*\zs=\ze\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1120 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1121 | \ contains=rakuPodAbbrNoCodeType 1122 | \ keepend 1123 | 1124 | syn region rakuPodAbbrNoCodeType 1125 | \ matchgroup=rakuPodType 1126 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1127 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1128 | \ contained 1129 | \ contains=rakuPodName,rakuPodAbbrNoCode 1130 | 1131 | syn match rakuPodName contained ".\+" contains=@rakuPodFormat 1132 | syn match rakuPodComment contained ".\+" 1133 | 1134 | syn region rakuPodAbbrNoCode 1135 | \ start="^" 1136 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1137 | \ contained 1138 | \ contains=@rakuPodFormat 1139 | 1140 | " Abbreviated blocks (everything is code) 1141 | syn region rakuPodAbbrRegion 1142 | \ matchgroup=rakuPodPrefix 1143 | \ start="^\s*\zs=\zecode\>" 1144 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1145 | \ contains=rakuPodAbbrCodeType 1146 | \ keepend 1147 | 1148 | syn region rakuPodAbbrCodeType 1149 | \ matchgroup=rakuPodType 1150 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1151 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1152 | \ contained 1153 | \ contains=rakuPodName,rakuPodAbbrCode 1154 | 1155 | syn region rakuPodAbbrCode 1156 | \ start="^" 1157 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1158 | \ contained 1159 | 1160 | " Abbreviated blocks (everything is a comment) 1161 | syn region rakuPodAbbrRegion 1162 | \ matchgroup=rakuPodPrefix 1163 | \ start="^=\zecomment\>" 1164 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1165 | \ contains=rakuPodAbbrCommentType 1166 | \ keepend 1167 | 1168 | syn region rakuPodAbbrCommentType 1169 | \ matchgroup=rakuPodType 1170 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1171 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1172 | \ contained 1173 | \ contains=rakuPodComment,rakuPodAbbrNoCode 1174 | 1175 | " Abbreviated blocks (implicit code allowed) 1176 | syn region rakuPodAbbrRegion 1177 | \ matchgroup=rakuPodPrefix 1178 | \ start="^=\ze\%(pod\|item\|nested\|\u\+\)\>" 1179 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1180 | \ contains=rakuPodAbbrType 1181 | \ keepend 1182 | 1183 | syn region rakuPodAbbrType 1184 | \ matchgroup=rakuPodType 1185 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1186 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1187 | \ contained 1188 | \ contains=rakuPodName,rakuPodAbbr 1189 | 1190 | syn region rakuPodAbbr 1191 | \ start="^" 1192 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1193 | \ contained 1194 | \ contains=@rakuPodFormat,rakuPodImplicitCode 1195 | 1196 | " Abbreviated block to end-of-file 1197 | syn region rakuPodAbbrRegion 1198 | \ matchgroup=rakuPodPrefix 1199 | \ start="^=\zeEND\>" 1200 | \ end="\%$" 1201 | \ contains=rakuPodAbbrEOFType 1202 | \ keepend 1203 | 1204 | syn region rakuPodAbbrEOFType 1205 | \ matchgroup=rakuPodType 1206 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1207 | \ end="\%$" 1208 | \ contained 1209 | \ contains=rakuPodName,rakuPodAbbrEOF 1210 | 1211 | syn region rakuPodAbbrEOF 1212 | \ start="^" 1213 | \ end="\%$" 1214 | \ contained 1215 | \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode 1216 | 1217 | " Directives 1218 | syn region rakuPodDirectRegion 1219 | \ matchgroup=rakuPodPrefix 1220 | \ start="^=\%(config\|use\)\>" 1221 | \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" 1222 | \ contains=rakuPodDirectArgRegion 1223 | \ keepend 1224 | 1225 | syn region rakuPodDirectArgRegion 1226 | \ matchgroup=rakuPodType 1227 | \ start="\S\+" 1228 | \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" 1229 | \ contained 1230 | \ contains=rakuPodDirectConfigRegion 1231 | 1232 | syn region rakuPodDirectConfigRegion 1233 | \ start="" 1234 | \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" 1235 | \ contained 1236 | \ contains=@rakuPodConfig 1237 | 1238 | " =encoding is a special directive 1239 | syn region rakuPodDirectRegion 1240 | \ matchgroup=rakuPodPrefix 1241 | \ start="^=encoding\>" 1242 | \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" 1243 | \ contains=rakuPodEncodingArgRegion 1244 | \ keepend 1245 | 1246 | syn region rakuPodEncodingArgRegion 1247 | \ matchgroup=rakuPodName 1248 | \ start="\S\+" 1249 | \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" 1250 | \ contained 1251 | 1252 | " Paragraph blocks (implicit code forbidden) 1253 | syn region rakuPodParaRegion 1254 | \ matchgroup=rakuPodPrefix 1255 | \ start="^\s*\zs=for\>" 1256 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1257 | \ contains=rakuPodParaNoCodeTypeRegion 1258 | \ keepend extend 1259 | 1260 | syn region rakuPodParaNoCodeTypeRegion 1261 | \ matchgroup=rakuPodType 1262 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1263 | \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1264 | \ contained 1265 | \ contains=rakuPodParaNoCode,rakuPodParaConfigRegion 1266 | 1267 | syn region rakuPodParaConfigRegion 1268 | \ start="" 1269 | \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\@1\ze\s*code\>" 1283 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1284 | \ contains=rakuPodParaCodeTypeRegion 1285 | \ keepend extend 1286 | 1287 | syn region rakuPodParaCodeTypeRegion 1288 | \ matchgroup=rakuPodType 1289 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1290 | \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1291 | \ contained 1292 | \ contains=rakuPodParaCode,rakuPodParaConfigRegion 1293 | 1294 | syn region rakuPodParaCode 1295 | \ start="^[^=]" 1296 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1297 | \ contained 1298 | 1299 | " Paragraph blocks (implicit code allowed) 1300 | syn region rakuPodParaRegion 1301 | \ matchgroup=rakuPodPrefix 1302 | \ start="^\s*\zs=for\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>" 1303 | \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1304 | \ contains=rakuPodParaTypeRegion 1305 | \ keepend extend 1306 | 1307 | syn region rakuPodParaTypeRegion 1308 | \ matchgroup=rakuPodType 1309 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1310 | \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1311 | \ contained 1312 | \ contains=rakuPodPara,rakuPodParaConfigRegion 1313 | 1314 | syn region rakuPodPara 1315 | \ start="^[^=]" 1316 | \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" 1317 | \ contained 1318 | \ contains=@rakuPodFormat,rakuPodImplicitCode 1319 | 1320 | " Paragraph block to end-of-file 1321 | syn region rakuPodParaRegion 1322 | \ matchgroup=rakuPodPrefix 1323 | \ start="^=for\>\ze\s\+END\>" 1324 | \ end="\%$" 1325 | \ contains=rakuPodParaEOFTypeRegion 1326 | \ keepend extend 1327 | 1328 | syn region rakuPodParaEOFTypeRegion 1329 | \ matchgroup=rakuPodType 1330 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1331 | \ end="\%$" 1332 | \ contained 1333 | \ contains=rakuPodParaEOF,rakuPodParaConfigRegion 1334 | 1335 | syn region rakuPodParaEOF 1336 | \ start="^[^=]" 1337 | \ end="\%$" 1338 | \ contained 1339 | \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode 1340 | 1341 | " Delimited blocks (implicit code forbidden) 1342 | syn region rakuPodDelimRegion 1343 | \ matchgroup=rakuPodPrefix 1344 | \ start="^\z(\s*\)\zs=begin\>" 1345 | \ end="^\z1\zs=end\>" 1346 | \ contains=rakuPodDelimNoCodeTypeRegion 1347 | \ keepend extend skipwhite 1348 | \ nextgroup=rakuPodType 1349 | 1350 | syn region rakuPodDelimNoCodeTypeRegion 1351 | \ matchgroup=rakuPodType 1352 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1353 | \ end="^\s*\zs\ze=end\>" 1354 | \ contained 1355 | \ contains=rakuPodDelimNoCode,rakuPodDelimConfigRegion 1356 | 1357 | syn region rakuPodDelimConfigRegion 1358 | \ start="" 1359 | \ end="^\s*\zs\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" 1360 | \ contained 1361 | \ contains=@rakuPodConfig 1362 | 1363 | syn region rakuPodDelimNoCode 1364 | \ start="^" 1365 | \ end="^\s*\zs\ze=end\>" 1366 | \ contained 1367 | \ contains=@rakuPodNestedBlocks,@rakuPodFormat 1368 | 1369 | " Delimited blocks (everything is code) 1370 | syn region rakuPodDelimRegion 1371 | \ matchgroup=rakuPodPrefix 1372 | \ start="^\z(\s*\)\zs=begin\>\ze\s*code\>" 1373 | \ end="^\z1\zs=end\>" 1374 | \ contains=rakuPodDelimCodeTypeRegion 1375 | \ keepend extend skipwhite 1376 | \ nextgroup=rakuPodType 1377 | 1378 | syn region rakuPodDelimCodeTypeRegion 1379 | \ matchgroup=rakuPodType 1380 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1381 | \ end="^\s*\zs\ze=end\>" 1382 | \ contained 1383 | \ contains=rakuPodDelimCode,rakuPodDelimConfigRegion 1384 | 1385 | syn region rakuPodDelimCode 1386 | \ start="^" 1387 | \ end="^\s*\zs\ze=end\>" 1388 | \ contained 1389 | \ contains=@rakuPodNestedBlocks 1390 | 1391 | " Delimited blocks (implicit code allowed) 1392 | syn region rakuPodDelimRegion 1393 | \ matchgroup=rakuPodPrefix 1394 | \ start="^\z(\s*\)\zs=begin\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>" 1395 | \ end="^\z1\zs=end\>" 1396 | \ contains=rakuPodDelimTypeRegion 1397 | \ keepend extend skipwhite 1398 | \ nextgroup=rakuPodType 1399 | 1400 | syn region rakuPodDelimTypeRegion 1401 | \ matchgroup=rakuPodType 1402 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1403 | \ end="^\s*\zs\ze=end\>" 1404 | \ contained 1405 | \ contains=rakuPodDelim,rakuPodDelimConfigRegion 1406 | 1407 | syn region rakuPodDelim 1408 | \ start="^" 1409 | \ end="^\s*\zs\ze=end\>" 1410 | \ contained 1411 | \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode 1412 | 1413 | " Delimited block to end-of-file 1414 | syn region rakuPodDelimRegion 1415 | \ matchgroup=rakuPodPrefix 1416 | \ start="^=begin\>\ze\s\+END\>" 1417 | \ end="\%$" 1418 | \ extend 1419 | \ contains=rakuPodDelimEOFTypeRegion 1420 | 1421 | syn region rakuPodDelimEOFTypeRegion 1422 | \ matchgroup=rakuPodType 1423 | \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1424 | \ end="\%$" 1425 | \ contained 1426 | \ contains=rakuPodDelimEOF,rakuPodDelimConfigRegion 1427 | 1428 | syn region rakuPodDelimEOF 1429 | \ start="^" 1430 | \ end="\%$" 1431 | \ contained 1432 | \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode 1433 | 1434 | syn cluster rakuPodConfig 1435 | \ add=rakuPodConfigOperator 1436 | \ add=rakuPodExtraConfig 1437 | \ add=rakuStringAuto 1438 | \ add=rakuPodAutoQuote 1439 | \ add=rakuStringSQ 1440 | 1441 | syn region rakuPodParens 1442 | \ start="(" 1443 | \ end=")" 1444 | \ contained 1445 | \ contains=rakuNumber,rakuStringSQ 1446 | 1447 | syn match rakuPodAutoQuote display contained "=>" 1448 | syn match rakuPodConfigOperator display contained ":!\?" nextgroup=rakuPodConfigOption 1449 | syn match rakuPodConfigOption display contained "[^[:space:](<]\+" nextgroup=rakuPodParens,rakuStringAngle 1450 | syn match rakuPodExtraConfig display contained "^=" 1451 | syn match rakuPodVerticalBar display contained "|" 1452 | syn match rakuPodColon display contained ":" 1453 | syn match rakuPodSemicolon display contained ";" 1454 | syn match rakuPodComma display contained "," 1455 | syn match rakuPodImplicitCode display contained "^\s.*" 1456 | syn match rakuPodType display contained "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" 1457 | 1458 | " These may appear inside delimited blocks 1459 | syn cluster rakuPodNestedBlocks 1460 | \ add=rakuPodAbbrRegion 1461 | \ add=rakuPodDirectRegion 1462 | \ add=rakuPodParaRegion 1463 | \ add=rakuPodDelimRegion 1464 | 1465 | " Pod formatting codes 1466 | 1467 | syn cluster rakuPodFormat 1468 | \ add=rakuPodFormatOne 1469 | \ add=rakuPodFormatTwo 1470 | \ add=rakuPodFormatThree 1471 | \ add=rakuPodFormatFrench 1472 | 1473 | " Balanced angles found inside formatting codes. Ensures proper nesting. 1474 | 1475 | syn region rakuPodFormatAnglesOne 1476 | \ matchgroup=rakuPodFormat 1477 | \ start="<" 1478 | \ skip="<[^>]*>" 1479 | \ end=">" 1480 | \ transparent contained 1481 | \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne 1482 | 1483 | syn region rakuPodFormatAnglesTwo 1484 | \ matchgroup=rakuPodFormat 1485 | \ start="<<" 1486 | \ skip="<<[^>]*>>" 1487 | \ end=">>" 1488 | \ transparent contained 1489 | \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne,rakuPodFormatAnglesTwo 1490 | 1491 | syn region rakuPodFormatAnglesThree 1492 | \ matchgroup=rakuPodFormat 1493 | \ start="<<<" 1494 | \ skip="<<<[^>]*>>>" 1495 | \ end=">>>" 1496 | \ transparent contained 1497 | \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne,rakuPodFormatAnglesTwo,rakuPodFormatAnglesThree 1498 | 1499 | syn region rakuPodFormatAnglesFrench 1500 | \ matchgroup=rakuPodFormat 1501 | \ start="«" 1502 | \ skip="«[^»]*»" 1503 | \ end="»" 1504 | \ transparent contained 1505 | \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne,rakuPodFormatAnglesTwo,rakuPodFormatAnglesThree 1506 | 1507 | " All formatting codes 1508 | 1509 | syn region rakuPodFormatOne 1510 | \ matchgroup=rakuPodFormatCode 1511 | \ start="\u<" 1512 | \ skip="<[^>]*>" 1513 | \ end=">" 1514 | \ contained 1515 | \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne 1516 | 1517 | syn region rakuPodFormatTwo 1518 | \ matchgroup=rakuPodFormatCode 1519 | \ start="\u<<" 1520 | \ skip="<<[^>]*>>" 1521 | \ end=">>" 1522 | \ contained 1523 | \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo 1524 | 1525 | syn region rakuPodFormatThree 1526 | \ matchgroup=rakuPodFormatCode 1527 | \ start="\u<<<" 1528 | \ skip="<<<[^>]*>>>" 1529 | \ end=">>>" 1530 | \ contained 1531 | \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree 1532 | 1533 | syn region rakuPodFormatFrench 1534 | \ matchgroup=rakuPodFormatCode 1535 | \ start="\u«" 1536 | \ skip="«[^»]*»" 1537 | \ end="»" 1538 | \ contained 1539 | \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree 1540 | 1541 | " C<> and V<> don't allow nested formatting formatting codes 1542 | 1543 | syn region rakuPodFormatOne 1544 | \ matchgroup=rakuPodFormatCode 1545 | \ start="[CV]<" 1546 | \ skip="<[^>]*>" 1547 | \ end=">" 1548 | \ contained 1549 | \ contains=rakuPodFormatAnglesOne 1550 | 1551 | syn region rakuPodFormatTwo 1552 | \ matchgroup=rakuPodFormatCode 1553 | \ start="[CV]<<" 1554 | \ skip="<<[^>]*>>" 1555 | \ end=">>" 1556 | \ contained 1557 | \ contains=rakuPodFormatAnglesTwo 1558 | 1559 | syn region rakuPodFormatThree 1560 | \ matchgroup=rakuPodFormatCode 1561 | \ start="[CV]<<<" 1562 | \ skip="<<<[^>]*>>>" 1563 | \ end=">>>" 1564 | \ contained 1565 | \ contains=rakuPodFormatAnglesThree 1566 | 1567 | syn region rakuPodFormatFrench 1568 | \ matchgroup=rakuPodFormatCode 1569 | \ start="[CV]«" 1570 | \ skip="«[^»]*»" 1571 | \ end="»" 1572 | \ contained 1573 | \ contains=rakuPodFormatAnglesFrench 1574 | 1575 | " L<> can have a "|" separator 1576 | 1577 | syn region rakuPodFormatOne 1578 | \ matchgroup=rakuPodFormatCode 1579 | \ start="L<" 1580 | \ skip="<[^>]*>" 1581 | \ end=">" 1582 | \ contained 1583 | \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodVerticalBar 1584 | 1585 | syn region rakuPodFormatTwo 1586 | \ matchgroup=rakuPodFormatCode 1587 | \ start="L<<" 1588 | \ skip="<<[^>]*>>" 1589 | \ end=">>" 1590 | \ contained 1591 | \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodVerticalBar 1592 | 1593 | syn region rakuPodFormatThree 1594 | \ matchgroup=rakuPodFormatCode 1595 | \ start="L<<<" 1596 | \ skip="<<<[^>]*>>>" 1597 | \ end=">>>" 1598 | \ contained 1599 | \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar 1600 | 1601 | syn region rakuPodFormatFrench 1602 | \ matchgroup=rakuPodFormatCode 1603 | \ start="L«" 1604 | \ skip="«[^»]*»" 1605 | \ end="»" 1606 | \ contained 1607 | \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar 1608 | 1609 | " E<> can have a ";" separator 1610 | 1611 | syn region rakuPodFormatOne 1612 | \ matchgroup=rakuPodFormatCode 1613 | \ start="E<" 1614 | \ skip="<[^>]*>" 1615 | \ end=">" 1616 | \ contained 1617 | \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodSemiColon 1618 | 1619 | syn region rakuPodFormatTwo 1620 | \ matchgroup=rakuPodFormatCode 1621 | \ start="E<<" 1622 | \ skip="<<[^>]*>>" 1623 | \ end=">>" 1624 | \ contained 1625 | \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodSemiColon 1626 | 1627 | syn region rakuPodFormatThree 1628 | \ matchgroup=rakuPodFormatCode 1629 | \ start="E<<<" 1630 | \ skip="<<<[^>]*>>>" 1631 | \ end=">>>" 1632 | \ contained 1633 | \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodSemiColon 1634 | 1635 | syn region rakuPodFormatFrench 1636 | \ matchgroup=rakuPodFormatCode 1637 | \ start="E«" 1638 | \ skip="«[^»]*»" 1639 | \ end="»" 1640 | \ contained 1641 | \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodSemiColon 1642 | 1643 | " M<> can have a ":" separator 1644 | 1645 | syn region rakuPodFormatOne 1646 | \ matchgroup=rakuPodFormatCode 1647 | \ start="M<" 1648 | \ skip="<[^>]*>" 1649 | \ end=">" 1650 | \ contained 1651 | \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodColon 1652 | 1653 | syn region rakuPodFormatTwo 1654 | \ matchgroup=rakuPodFormatCode 1655 | \ start="M<<" 1656 | \ skip="<<[^>]*>>" 1657 | \ end=">>" 1658 | \ contained 1659 | \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodColon 1660 | 1661 | syn region rakuPodFormatThree 1662 | \ matchgroup=rakuPodFormatCode 1663 | \ start="M<<<" 1664 | \ skip="<<<[^>]*>>>" 1665 | \ end=">>>" 1666 | \ contained 1667 | \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodColon 1668 | 1669 | syn region rakuPodFormatFrench 1670 | \ matchgroup=rakuPodFormatCode 1671 | \ start="M«" 1672 | \ skip="«[^»]*»" 1673 | \ end="»" 1674 | \ contained 1675 | \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodColon 1676 | 1677 | " D<> can have "|" and ";" separators 1678 | 1679 | syn region rakuPodFormatOne 1680 | \ matchgroup=rakuPodFormatCode 1681 | \ start="D<" 1682 | \ skip="<[^>]*>" 1683 | \ end=">" 1684 | \ contained 1685 | \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodVerticalBar,rakuPodSemiColon 1686 | 1687 | syn region rakuPodFormatTwo 1688 | \ matchgroup=rakuPodFormatCode 1689 | \ start="D<<" 1690 | \ skip="<<[^>]*>>" 1691 | \ end=">>" 1692 | \ contained 1693 | \ contains=rakuPodFormatAngleTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodVerticalBar,rakuPodSemiColon 1694 | 1695 | syn region rakuPodFormatThree 1696 | \ matchgroup=rakuPodFormatCode 1697 | \ start="D<<<" 1698 | \ skip="<<<[^>]*>>>" 1699 | \ end=">>>" 1700 | \ contained 1701 | \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon 1702 | 1703 | syn region rakuPodFormatFrench 1704 | \ matchgroup=rakuPodFormatCode 1705 | \ start="D«" 1706 | \ skip="«[^»]*»" 1707 | \ end="»" 1708 | \ contained 1709 | \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon 1710 | 1711 | " X<> can have "|", "," and ";" separators 1712 | 1713 | syn region rakuPodFormatOne 1714 | \ matchgroup=rakuPodFormatCode 1715 | \ start="X<" 1716 | \ skip="<[^>]*>" 1717 | \ end=">" 1718 | \ contained 1719 | \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma 1720 | 1721 | syn region rakuPodFormatTwo 1722 | \ matchgroup=rakuPodFormatCode 1723 | \ start="X<<" 1724 | \ skip="<<[^>]*>>" 1725 | \ end=">>" 1726 | \ contained 1727 | \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma 1728 | 1729 | syn region rakuPodFormatThree 1730 | \ matchgroup=rakuPodFormatCode 1731 | \ start="X<<<" 1732 | \ skip="<<<[^>]*>>>" 1733 | \ end=">>>" 1734 | \ contained 1735 | \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma 1736 | 1737 | syn region rakuPodFormatFrench 1738 | \ matchgroup=rakuPodFormatCode 1739 | \ start="X«" 1740 | \ skip="«[^»]*»" 1741 | \ end="»" 1742 | \ contained 1743 | \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma 1744 | 1745 | " Define the default highlighting. 1746 | " For version 5.7 and earlier: only when not done already 1747 | " For version 5.8 and later: only when an item doesn't have highlighting yet 1748 | if version >= 508 || !exists("did_raku_syntax_inits") 1749 | if version < 508 1750 | let did_raku_syntax_inits = 1 1751 | command -nargs=+ HiLink hi link 1752 | else 1753 | command -nargs=+ HiLink hi def link 1754 | endif 1755 | 1756 | HiLink rakuEscOctOld rakuError 1757 | HiLink rakuPackageTwigil rakuTwigil 1758 | HiLink rakuStringAngle rakuString 1759 | HiLink rakuStringAngleFixed rakuString 1760 | HiLink rakuStringFrench rakuString 1761 | HiLink rakuStringAngles rakuString 1762 | HiLink rakuStringSQ rakuString 1763 | HiLink rakuStringDQ rakuString 1764 | HiLink rakuStringQ rakuString 1765 | HiLink rakuStringQ_q rakuString 1766 | HiLink rakuStringQ_qww rakuString 1767 | HiLink rakuStringQ_qq rakuString 1768 | HiLink rakuStringQ_to rakuString 1769 | HiLink rakuStringQ_qto rakuString 1770 | HiLink rakuStringQ_qqto rakuString 1771 | HiLink rakuRxStringSQ rakuString 1772 | HiLink rakuRxStringDQ rakuString 1773 | HiLink rakuReplacement rakuString 1774 | HiLink rakuReplCurly rakuString 1775 | HiLink rakuReplAngle rakuString 1776 | HiLink rakuReplFrench rakuString 1777 | HiLink rakuReplBracket rakuString 1778 | HiLink rakuReplParen rakuString 1779 | HiLink rakuTransliteration rakuString 1780 | HiLink rakuTransRepl rakuString 1781 | HiLink rakuTransReplCurly rakuString 1782 | HiLink rakuTransReplAngle rakuString 1783 | HiLink rakuTransReplFrench rakuString 1784 | HiLink rakuTransReplBracket rakuString 1785 | HiLink rakuTransReplParen rakuString 1786 | HiLink rakuStringAuto rakuString 1787 | HiLink rakuKey rakuString 1788 | HiLink rakuMatch rakuString 1789 | HiLink rakuSubstitution rakuString 1790 | HiLink rakuMatchBare rakuString 1791 | HiLink rakuRegexBlock rakuString 1792 | HiLink rakuRxP5CharClass rakuString 1793 | HiLink rakuRxP5QuoteMeta rakuString 1794 | HiLink rakuRxCharClass rakuString 1795 | HiLink rakuRxQuoteWords rakuString 1796 | HiLink rakuReduceOp rakuOperator 1797 | HiLink rakuSetOp rakuOperator 1798 | HiLink rakuRSXZOp rakuOperator 1799 | HiLink rakuHyperOp rakuOperator 1800 | HiLink rakuPostHyperOp rakuOperator 1801 | HiLink rakuQuoteQ rakuQuote 1802 | HiLink rakuQuoteQ_q rakuQuote 1803 | HiLink rakuQuoteQ_qww rakuQuote 1804 | HiLink rakuQuoteQ_qq rakuQuote 1805 | HiLink rakuQuoteQ_to rakuQuote 1806 | HiLink rakuQuoteQ_qto rakuQuote 1807 | HiLink rakuQuoteQ_qqto rakuQuote 1808 | HiLink rakuQuoteQ_PIR rakuQuote 1809 | HiLink rakuMatchStart_m rakuQuote 1810 | HiLink rakuMatchStart_s rakuQuote 1811 | HiLink rakuMatchStart_tr rakuQuote 1812 | HiLink rakuBareSigil rakuVariable 1813 | HiLink rakuRxRange rakuStringSpecial 1814 | HiLink rakuRxAnchor rakuStringSpecial 1815 | HiLink rakuRxBoundary rakuStringSpecial 1816 | HiLink rakuRxP5Anchor rakuStringSpecial 1817 | HiLink rakuCodePoint rakuStringSpecial 1818 | HiLink rakuRxMeta rakuStringSpecial 1819 | HiLink rakuRxP5Range rakuStringSpecial 1820 | HiLink rakuRxP5CPId rakuStringSpecial 1821 | HiLink rakuRxP5Posix rakuStringSpecial 1822 | HiLink rakuRxP5Mod rakuStringSpecial 1823 | HiLink rakuRxP5HexSeq rakuStringSpecial 1824 | HiLink rakuRxP5OctSeq rakuStringSpecial 1825 | HiLink rakuRxP5WriteRefId rakuStringSpecial 1826 | HiLink rakuHexSequence rakuStringSpecial 1827 | HiLink rakuOctSequence rakuStringSpecial 1828 | HiLink rakuRxP5Named rakuStringSpecial 1829 | HiLink rakuRxP5PropId rakuStringSpecial 1830 | HiLink rakuRxP5Quantifier rakuStringSpecial 1831 | HiLink rakuRxP5CountId rakuStringSpecial 1832 | HiLink rakuRxP5Verb rakuStringSpecial 1833 | HiLink rakuRxAssertGroup rakuStringSpecial2 1834 | HiLink rakuEscape rakuStringSpecial2 1835 | HiLink rakuEscNull rakuStringSpecial2 1836 | HiLink rakuEscHash rakuStringSpecial2 1837 | HiLink rakuEscQQ rakuStringSpecial2 1838 | HiLink rakuEscQuote rakuStringSpecial2 1839 | HiLink rakuEscDoubleQuote rakuStringSpecial2 1840 | HiLink rakuEscBackTick rakuStringSpecial2 1841 | HiLink rakuEscForwardSlash rakuStringSpecial2 1842 | HiLink rakuEscVerticalBar rakuStringSpecial2 1843 | HiLink rakuEscExclamation rakuStringSpecial2 1844 | HiLink rakuEscDollar rakuStringSpecial2 1845 | HiLink rakuEscOpenCurly rakuStringSpecial2 1846 | HiLink rakuEscCloseCurly rakuStringSpecial2 1847 | HiLink rakuEscCloseBracket rakuStringSpecial2 1848 | HiLink rakuEscCloseAngle rakuStringSpecial2 1849 | HiLink rakuEscCloseFrench rakuStringSpecial2 1850 | HiLink rakuEscBackSlash rakuStringSpecial2 1851 | HiLink rakuEscCodePoint rakuStringSpecial2 1852 | HiLink rakuEscOct rakuStringSpecial2 1853 | HiLink rakuEscHex rakuStringSpecial2 1854 | HiLink rakuRxEscape rakuStringSpecial2 1855 | HiLink rakuRxCapture rakuStringSpecial2 1856 | HiLink rakuRxAlternation rakuStringSpecial2 1857 | HiLink rakuRxP5 rakuStringSpecial2 1858 | HiLink rakuRxP5ReadRef rakuStringSpecial2 1859 | HiLink rakuRxP5Oct rakuStringSpecial2 1860 | HiLink rakuRxP5Hex rakuStringSpecial2 1861 | HiLink rakuRxP5EscMeta rakuStringSpecial2 1862 | HiLink rakuRxP5Meta rakuStringSpecial2 1863 | HiLink rakuRxP5Escape rakuStringSpecial2 1864 | HiLink rakuRxP5CodePoint rakuStringSpecial2 1865 | HiLink rakuRxP5WriteRef rakuStringSpecial2 1866 | HiLink rakuRxP5Prop rakuStringSpecial2 1867 | 1868 | HiLink rakuProperty Tag 1869 | HiLink rakuAttention Todo 1870 | HiLink rakuType Type 1871 | HiLink rakuError Error 1872 | HiLink rakuBlockLabel Label 1873 | HiLink rakuNormal Normal 1874 | HiLink rakuIdentifier Normal 1875 | HiLink rakuPackage Normal 1876 | HiLink rakuPackageScope Normal 1877 | HiLink rakuNumber Number 1878 | HiLink rakuOctNumber Number 1879 | HiLink rakuBinNumber Number 1880 | HiLink rakuHexNumber Number 1881 | HiLink rakuDecNumber Number 1882 | HiLink rakuString String 1883 | HiLink rakuRepeat Repeat 1884 | HiLink rakuPragma Keyword 1885 | HiLink rakuPreDeclare Keyword 1886 | HiLink rakuDeclare Keyword 1887 | HiLink rakuDeclareRegex Keyword 1888 | HiLink rakuVarStorage Special 1889 | HiLink rakuFlowControl Special 1890 | HiLink rakuOctBase Special 1891 | HiLink rakuBinBase Special 1892 | HiLink rakuHexBase Special 1893 | HiLink rakuDecBase Special 1894 | HiLink rakuTwigil Special 1895 | HiLink rakuStringSpecial2 Special 1896 | HiLink rakuVersion Special 1897 | HiLink rakuComment Comment 1898 | HiLink rakuBracketComment Comment 1899 | HiLink rakuInclude Include 1900 | HiLink rakuShebang PreProc 1901 | HiLink rakuClosureTrait PreProc 1902 | HiLink rakuOperator Operator 1903 | HiLink rakuContext Operator 1904 | HiLink rakuQuote Delimiter 1905 | HiLink rakuTypeConstraint PreCondit 1906 | HiLink rakuException Exception 1907 | HiLink rakuVariable Identifier 1908 | HiLink rakuVarSlash Identifier 1909 | HiLink rakuVarNum Identifier 1910 | HiLink rakuVarExclam Identifier 1911 | HiLink rakuVarMatch Identifier 1912 | HiLink rakuVarName Identifier 1913 | HiLink rakuMatchVar Identifier 1914 | HiLink rakuRxP5ReadRefId Identifier 1915 | HiLink rakuRxP5ModDef Identifier 1916 | HiLink rakuRxP5ModName Identifier 1917 | HiLink rakuConditional Conditional 1918 | HiLink rakuStringSpecial SpecialChar 1919 | 1920 | HiLink rakuPodAbbr rakuPod 1921 | HiLink rakuPodAbbrEOF rakuPod 1922 | HiLink rakuPodAbbrNoCode rakuPod 1923 | HiLink rakuPodAbbrCode rakuPodCode 1924 | HiLink rakuPodPara rakuPod 1925 | HiLink rakuPodParaEOF rakuPod 1926 | HiLink rakuPodParaNoCode rakuPod 1927 | HiLink rakuPodParaCode rakuPodCode 1928 | HiLink rakuPodDelim rakuPod 1929 | HiLink rakuPodDelimEOF rakuPod 1930 | HiLink rakuPodDelimNoCode rakuPod 1931 | HiLink rakuPodDelimCode rakuPodCode 1932 | HiLink rakuPodImplicitCode rakuPodCode 1933 | HiLink rakuPodExtraConfig rakuPodPrefix 1934 | HiLink rakuPodVerticalBar rakuPodFormatCode 1935 | HiLink rakuPodColon rakuPodFormatCode 1936 | HiLink rakuPodSemicolon rakuPodFormatCode 1937 | HiLink rakuPodComma rakuPodFormatCode 1938 | HiLink rakuPodFormatOne rakuPodFormat 1939 | HiLink rakuPodFormatTwo rakuPodFormat 1940 | HiLink rakuPodFormatThree rakuPodFormat 1941 | HiLink rakuPodFormatFrench rakuPodFormat 1942 | 1943 | HiLink rakuPodType Type 1944 | HiLink rakuPodConfigOption String 1945 | HiLink rakuPodCode PreProc 1946 | HiLink rakuPod Comment 1947 | HiLink rakuPodComment Comment 1948 | HiLink rakuPodAutoQuote Operator 1949 | HiLink rakuPodConfigOperator Operator 1950 | HiLink rakuPodPrefix Statement 1951 | HiLink rakuPodName Identifier 1952 | HiLink rakuPodFormatCode SpecialChar 1953 | HiLink rakuPodFormat SpecialComment 1954 | 1955 | delcommand HiLink 1956 | endif 1957 | 1958 | if exists("raku_fold") || exists("raku_extended_all") 1959 | setl foldmethod=syntax 1960 | syn region rakuBlockFold 1961 | \ start="^\z(\s*\)\%(my\|our\|augment\|multi\|proto\|only\)\?\s*\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\s\+\)\?\<\%(CATCH\|try\|ENTER\|LEAVE\|CHECK\|INIT\|BEGIN\|END\|KEEP\|UNDO\|PRE\|POST\|module\|package\|enum\|subset\|class\|sub\%(method\)\?\|multi\|method\|slang\|grammar\|regex\|token\|rule\)\>[^{]\+\%({\s*\%(#.*\)\?\)\?$" 1962 | \ end="^\z1}" 1963 | \ transparent fold keepend extend 1964 | endif 1965 | 1966 | let b:current_syntax = "raku" 1967 | 1968 | let &cpo = s:keepcpo 1969 | unlet s:keepcpo 1970 | 1971 | " vim:ts=8:sts=4:sw=4:expandtab:ft=vim 1972 | -------------------------------------------------------------------------------- /t/07_raku_folding.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use lib 'tools'; 4 | 5 | use Test::More tests => 1; 6 | use Local::VimFolds; 7 | 8 | my $folds = Local::VimFolds->new( 9 | language => 'raku', 10 | options => { 11 | raku_fold => 1, 12 | }, 13 | ); 14 | 15 | $folds->folds_match(<<'END_PERL6', 'general folding'); 16 | class Foo { # {{{ 17 | has $.dsfdsf; 18 | 19 | method bla { say "foo" } 20 | 21 | method Bar { # {{{ 22 | say "dfdsf"; 23 | } # }}} 24 | } # }}} 25 | grammar Foo { # {{{ 26 | rule Foo { sdfsdf } 27 | 28 | rule Bla { # {{{ 29 | } # }}} 30 | } # }}} 31 | sub foo { # {{{ 32 | } # }}} 33 | our sub Foobar { # {{{ 34 | dsfsdfsdfsdf 35 | }; # }}} 36 | my Int sub foo(Str $bar) { # {{{ 37 | say $bar; 38 | } # }}} 39 | sub foo # {{{ 40 | { 41 | } # }}} 42 | END_PERL6 43 | -------------------------------------------------------------------------------- /t_source/raku/basic.t: -------------------------------------------------------------------------------- 1 | #!raku 2 | 3 | for @foo <-> $value { 4 | } 5 | sub infix:<->(Foo) is required { 6 | } 7 | 8 | my &double-invert = &invert o &double; 9 | my &double-invert = &invert ∘ &double; 10 | 11 | "foo $bar.baz() $?CLASS.hi() $gsdf.hlagh(foo => 3) $much.^meta().wow()" 12 | 13 | ( < foo bar>) 14 | class Request { } 15 | 16 | ok("a cat_O_9_tails" ~~ m:s/ /, 'Standard captures' ); 17 | 18 | is 'aa'.trans(/ ./ => 'b'), 'ab', 'trans with look-around regex'; 19 | is ("!$_!" for (1, 2)>>.trans((1..26) => (14..26,1..13))), , "same with explicit for"; 20 | is $s.trans([] => [{++$x},{++$y}]), 'a3b3c4d4', 'can use closures in pairs of arrays'; 21 | 22 | token twigil:sym<=> { } 23 | %*LANG = ::STD::Q ; 24 | [@(@foo)] 25 | [@bar] 26 | when :(Str $ where /^The \s \S+ \s \w+$/) { } 27 | 28 | $foo.state 29 | $foo.die 30 | @p = $x [[+]]= 6, 7; 31 | 32 | say .key * .value with @foo.first({ .value >= 3 }); 33 | 34 | @foo Z @bar 35 | is (1 R[R[R-]] 2), 1, 'R[R[R-]] works'; 36 | 37 | my @seq = map { $_ ~ ++$ }, ; 38 | $c++ for $@a; 39 | 40 | ok "a" ![!eq] "a", '![!eq] is legal and works (1)'; 41 | is A.new.m, 'aaa', '[~] works in first class'; 42 | my $l = (1,2,3 Z, 4,5,6 Z, 7,8,9); 43 | 44 | nok $mh (<+) $m, "Our MixHash is not a msubset of our Mix (texas)"; 45 | ok $b (<) $bub, "(<) - {$b.gist} is a strict submix of {$bub.gist} (texas)"; 46 | 47 | is test_ff({/B/ fff^ /B/ }, ), 'xBAxx', '/B/ fff^ /B/, lhs == rhs'; 48 | 49 | use v6.* 50 | use v6* 51 | 52 | rule => "foo" 53 | -100 54 | is Inf / 100, Inf; 55 | is Inf*-100, -Inf; 56 | is Inf / -100, -Inf; 57 | is 100 / Inf, 0; 58 | 59 | @definitions = [.[0].words[0], .[1].contents[0]]; 60 | 61 | [['foo']]; 62 | 63 | X::Foo::Bar 64 | bag() 65 | Str() 66 | 67 | is showkv([(.)] @d), showkv(∅), "Bag multiply reduce works on nothing"; 68 | 69 | .>>[0]>>.Str.unique; 70 | 71 | sub process-pod-dir($dir, :&sorted-by = &[cmp], :$sparse) { } 72 | 73 | use Foo::Xbar; # not a cross-operator 74 | 75 | tokenizer($str); 76 | 77 | Zfoobar.new; 78 | Rcmp 79 | 80 | S|sdfsdf|sdfsdf| 81 | 82 | proto sub infix:«>»(Any, Any) returns Bool:D is assoc 83 | multi sub infix:«>»(Int:D, Int:D) 84 | multi sub infix:«>»(Num:D, Num:D) 85 | multi sub infix:«>»(Real:D, Real:D) 86 | 87 | proto sub infix:<>(Mu, Mu) returns Bool:D is assoc 88 | multi sub infix:(Mu, Mu) 89 | multi sub infix:(Str:D, Str:D) 90 | 91 | v5.2.* 92 | v1.2+ 93 | v1.2.0.0.0.0.0 94 | v1 95 | 96 | @foo.map { $^a.key => $^a.value } 97 | 98 | [1,2] xx 3; 99 | 100 | token foo { 101 | <*foo-bar> 102 | (<-[:]>*) 103 | 104 | } 105 | 106 | "foo = $"; 107 | 108 | state %sub-menus = @menu>>.key>>[0] Z=> @menu>>.value; 109 | 110 | is( # vowels become 'y' and whitespace becomes '_' 111 | "ab\ncd\tef gh".trans(/<[aeiou]>/ => 'y', /\s/ => '_'), 112 | 'yb_cd_yf_gh', 113 | 'regexes pairs work', 114 | ); 115 | 116 | if $subkinds ∋ 'method' { } 117 | 118 | is('ababab'.trans([/ab/, 'aba', 'bab', /baba/] => 119 | ['1', '2', '3', '4' ]), 120 | '23', 121 | 'longest token still holds, even between constant strings and regexes'); 122 | 123 | method info { [~] ' -- ', $.name, 124 | (' [', @.vars».join(', '), ']' if @.vars) } 125 | 126 | s[foo][bar $baz] 127 | tr|a..c|A..C|; 128 | $japh ~~ tr[a..zA..Z][n..za..mN..ZA..M]; 129 | tr/$123/X\x20\o40\t/; 130 | 131 | ok(" a b\tc" ~~ m/@=( \s+ \S+ )+/, 'Named simple array capture'); 132 | ok("abcxyd" ~~ m/a @=(.(.))+ d/, 'Repeated hypothetical array capture'); 133 | ok(" a b\tc" ~~ m/@=[ () (\S+)]+/, 'Nested multiple array capture'); 134 | 135 | isa_ok(regex {oo}, Regex); 136 | isa_ok(rx (o), Regex) 137 | my @delims = < ^ ° ! " § $ % @ € & / = ? ` * + ~ ; , . | >; 138 | 139 | $foo.regex() 140 | $foo .= substr(4); 141 | 142 | my $foo ~~ /foobar/; 143 | $foo /= 4; 144 | $foo // $bar; 145 | (1,2)[*/2]; 146 | while /foobar/ { 147 | } 148 | $a = $bla / 5; 149 | 150 | $foo ~~ m«sdfdfsdf» 151 | $foo ~~ s/foo/$bar/; 152 | 153 | $foo ~~ m/sd$/ 154 | $foo ~~ s/sd$/foo$bar/ 155 | $foo ~~ s{sdfsdf} 156 | $foo ~~ tr/dsf/sdf/ 157 | 158 | sub next {} 159 | 160 | $ 161 | Order::Same 162 | Bool::True 163 | /sdfdsf/ 164 | given $foo { 165 | when /dsfsdf/ { 166 | } 167 | } 168 | foo::bar / 4; 169 | while /foo/; 170 | say @foo.grep: /dsfsdf/ 171 | say @foo.grep(/dsfsdf/) 172 | $bla / 3; 173 | 174 | Inf 175 | -Inf 176 | +Inf 177 | NaN 178 | -NaN 179 | -3.340404 180 | 0.3 181 | .3 182 | 100_000 183 | 1.2e7_000 184 | 1.2e-7 185 | 186 | my @args = <-a -e -b -v>; 187 | 188 | token foo { 189 | <* < foo bar > > 190 | } 191 | use v6.0.0; 192 | use Test; 193 | say "foo bar"; 194 | @foo.push: "bar"; 195 | 196 | - 0o500 197 | -0o500 198 | -0x500 199 | 0d500 200 | 201 | LABEL: for 0..$string.chars-1 -> $pos { 202 | } 203 | 204 | $sum += $num if $num.is-prime; 205 | 206 | sub if'a($x) {$x} 207 | is if'a(5), 5, "if'a is a valid sub name"; 208 | 209 | ok (my % = baz => "luhrman"), 'initialized bare sigil hash %'; 210 | if ($foo % 3 == 0) { 211 | } 212 | 213 | my $f = * !< 3; 214 | isa_ok $f, Code, 'Whatever-currying !< (1)'; 215 | 216 | my $quote = q//; 217 | my $call = q(); 218 | 219 | @data ==> grep {/<[aeiouy]>/} ==> is($(*), $(@out), 'basic test for $(*)'); 220 | 221 | sub is-cool { 222 | } 223 | 224 | sub q { 225 | } 226 | 227 | =begin foo-bar 228 | 229 | bla 230 | 231 | =end foo-bar 232 | 233 | @foo».++; 234 | 235 | $foo.^method 236 | 237 | say Buf.new(+«"127.0.0.1".split(".")).unpack("N") 238 | 239 | [&sprintf] 240 | X[&sprintf] 241 | $foo, $, $bar = @bla; 242 | $foo, @, $bar = @bla; 243 | 244 | isa_ok NaN + 1i, Complex, "NaN + 1i is a Complex number"; 245 | ok NaN + 1i ~~ NaN, "NaN + 1i ~~ NaN"; 246 | ok NaN ~~ NaN + 1i, "NaN ~~ NaN + 1i"; 247 | 248 | my $str = "bla bla &is-cool() yes"; 249 | 250 | class Foo-Bar { 251 | method bla { say "foo" } 252 | } 253 | 254 | class Bla'Bla { 255 | method boo { say "bar" } 256 | } 257 | 258 | Inf, -Inf, NaN, +Inf 259 | 260 | # old-style octals are bad 261 | "\10" 262 | "\123" 263 | # ascii nul is ok though 264 | "\040" 265 | 266 | for ('/foo/bar/baz/' ~~ m/^ $=(.* '/'+)? $=(<-[\/]>+) '/'* $ /).gist.lines { 267 | %count{$0}++ if / ^ \s+ (\w+) \s+ '=>' /; ## extract key 268 | }; 269 | throws_like "my Int a = 10;", X::Syntax::Malformed, message => / sigilless /; 270 | 271 | $foo ~~ S/foo/bar/; 272 | 273 | my() 274 | BEGIN() 275 | 276 | # vim: ft=raku 277 | -------------------------------------------------------------------------------- /t_source/raku/basic.t.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [untitled] 5 | 6 | 7 | 8 | 9 |
#!raku
 10 | 
 11 | for @foo <-> $value {
 12 | }
 13 | sub infix:<->(Foo) is required {
 14 | }
 15 | 
 16 | my &double-invert = &invert o &double;
 17 | my &double-invert = &invert  &double;
 18 | 
 19 | "foo $bar.baz() $?CLASS.hi() $gsdf.hlagh(foo => 3) $much.^meta().wow()"
 20 | 
 21 | ( < foo bar>)
 22 | class Request { }
 23 | 
 24 | ok("a cat_O_9_tails" ~~ m:s/<alpha> <ident>/, 'Standard captures' );
 25 | 
 26 | is 'aa'.trans(/ <after a> ./ => 'b'), 'ab', 'trans with look-around regex';
 27 | is ("!$_!" for (1, 2)>>.trans((1..26) => (14..26,1..13))), <!14! !15!>, "same with explicit for";
 28 | is $s.trans([<X Y>] => [{++$x},{++$y}]), 'a3b3c4d4', 'can use closures in pairs of arrays';
 29 | 
 30 | token twigil:sym<=> { <sym> }
 31 | %*LANG<Q>       = ::STD::Q ;
 32 | [@(@foo)]
 33 | [@bar]
 34 | when :(Str $ where /^The \s \S+ \s \w+$/) { }
 35 | 
 36 | $foo.state
 37 | $foo.die
 38 | @p = $x [[+]]= 6, 7;
 39 | 
 40 | say .key * .value with @foo.first({ .value >= 3 });
 41 | 
 42 | @foo Z @bar
 43 | is (1 R[R[R-]] 2), 1, 'R[R[R-]] works';
 44 | 
 45 | my @seq = map { $_ ~ ++$ }, <a b c>;
 46 | $c++ for $@a;
 47 | 
 48 | ok "a" ![!eq] "a", '![!eq] is legal and works (1)';
 49 | is A.new.m, 'aaa',  '[~] works in first class';
 50 | my $l = (1,2,3 Z, 4,5,6 Z, 7,8,9);
 51 | 
 52 | nok $mh (<+) $m, "Our MixHash is not a msubset of our Mix (texas)";
 53 | ok $b (<) $bub, "(<) - {$b.gist} is a strict submix of {$bub.gist} (texas)";
 54 | 
 55 | is test_ff({/B/ fff^ /B/ }, <A B A B A>), 'xBAxx', '/B/ fff^ /B/, lhs == rhs';
 56 | 
 57 | use v6.*
 58 | use v6*
 59 | 
 60 | rule => "foo"
 61 | -100
 62 | is Inf / 100, Inf;
 63 | is Inf*-100, -Inf;
 64 | is Inf / -100, -Inf;
 65 | is 100 / Inf, 0;
 66 | 
 67 | @definitions = [.[0].words[0], .[1].contents[0]];
 68 | 
 69 | [['foo']];
 70 | 
 71 | X::Foo::Bar
 72 | bag()
 73 | Str()
 74 | 
 75 | is showkv([(.)] @d), showkv(), "Bag multiply reduce works on nothing";
 76 | 
 77 | .>>[0]>>.Str.unique;
 78 | 
 79 | sub process-pod-dir($dir, :&sorted-by = &[cmp], :$sparse) { }
 80 | 
 81 | use Foo::Xbar; # not a cross-operator
 82 | 
 83 | tokenizer($str);
 84 | 
 85 | Zfoobar.new;
 86 | Rcmp
 87 | 
 88 | S|sdfsdf|sdfsdf|
 89 | 
 90 | proto sub infix:«>»(Any, Any) returns Bool:D is assoc<chain>
 91 | multi sub infix:«>»(Int:D, Int:D)
 92 | multi sub infix:«>»(Num:D, Num:D)
 93 | multi sub infix:«>»(Real:D, Real:D)
 94 | 
 95 | proto sub infix:<<lt>>(Mu, Mu) returns Bool:D is assoc<chain>
 96 | multi sub infix:<lt>(Mu,    Mu)
 97 | multi sub infix:<lt>(Str:D, Str:D)
 98 | 
 99 | v5.2.*
100 | v1.2+
101 | v1.2.0.0.0.0.0
102 | v1
103 | 
104 | @foo.map { $^a.key => $^a.value }
105 | 
106 | [1,2] xx 3;
107 | 
108 | token foo {
109 |     <*foo-bar>
110 |     (<-[:]>*)
111 |     <foo=.file>
112 | }
113 | 
114 | "foo = $<foo>";
115 | 
116 | state %sub-menus = @menu>>.key>>[0] Z=> @menu>>.value;
117 | 
118 | is( # vowels become 'y' and whitespace becomes '_'
119 |     "ab\ncd\tef gh".trans(/<[aeiou]>/ => 'y', /\s/ => '_'),
120 |     'yb_cd_yf_gh',
121 |     'regexes pairs work',
122 | );
123 | 
124 | if $subkinds  'method' { }
125 | 
126 | is('ababab'.trans([/ab/, 'aba', 'bab', /baba/] =>
127 |                    ['1',  '2',   '3',   '4'   ]),
128 |    '23',
129 |    'longest token still holds, even between constant strings and regexes');
130 | 
131 | method info { [~] ' -- ', $.name,
132 |                     (' [', @.vars»<name>.join(', '), ']' if @.vars) }
133 | 
134 | s[foo][bar $baz]
135 | tr|a..c|A..C|;
136 | $japh ~~ tr[a..zA..Z][n..za..mN..ZA..M];
137 | tr/$123/X\x20\o40\t/;
138 | 
139 | ok("  a b\tc" ~~ m/@<chars>=( \s+ \S+ )+/, 'Named simple array capture');
140 | ok("abcxyd" ~~ m/a  @<foo>=(.(.))+ d/, 'Repeated hypothetical array capture');
141 | ok("  a b\tc" ~~ m/@<chars>=[ (<?spaces>) (\S+)]+/, 'Nested multiple array capture');
142 | 
143 | isa_ok(regex {oo}, Regex);
144 | isa_ok(rx (o), Regex)
145 | my @delims = < ^ ° ! " § $ % @ € & / = ? ` * + ~ ; , . | >;
146 | 
147 | $foo.regex()
148 | $foo .= substr(4);
149 | 
150 | my $foo ~~ /foobar/;
151 | $foo /= 4;
152 | $foo // $bar;
153 | (1,2)[*/2];
154 | while /foobar/ {
155 | }
156 | $a = $bla / 5;
157 | 
158 | $foo ~~ sdfdfsdf»
159 | $foo ~~ s/foo/$bar/;
160 | 
161 | $foo ~~ m/sd$/
162 | $foo ~~ s/sd$/foo$bar/
163 | $foo ~~ s{sdfsdf}
164 | $foo ~~ tr/dsf/sdf/
165 | 
166 | sub next {}
167 | 
168 | $<bar>
169 | Order::Same
170 | Bool::True
171 | /sdfdsf/
172 | given $foo {
173 |     when /dsfsdf/ {
174 |     }
175 | }
176 | foo::bar / 4;
177 | while /foo/;
178 | say @foo.grep: /dsfsdf/
179 | say @foo.grep(/dsfsdf/)
180 | $bla / 3;
181 | 
182 | Inf
183 | -Inf
184 | +Inf
185 | NaN
186 | -NaN
187 | -3.340404
188 | 0.3
189 | .3
190 | 100_000
191 | 1.2e7_000
192 | 1.2e-7
193 | 
194 | my @args = <-a -e -b -v>;
195 | 
196 | token foo {
197 |     <* < foo bar > >
198 | }
199 | use v6.0.0;
200 | use Test;
201 | say "foo bar";
202 | @foo.push: "bar";
203 | 
204 | - 0o500
205 | -0o500
206 | -0x500
207 | 0d500
208 | 
209 | LABEL: for 0..$string.chars-1 -> $pos {
210 | }
211 | 
212 | $sum += $num if $num.is-prime;
213 | 
214 | sub if'a($x) {$x}
215 | is if'a(5), 5, "if'a is a valid sub name";
216 | 
217 | ok (my % = baz => "luhrman"), 'initialized bare sigil hash %';
218 | if ($foo % 3 == 0) {
219 | }
220 | 
221 | my $f = * !< 3;
222 | isa_ok $f, Code, 'Whatever-currying !< (1)';
223 | 
224 | my $quote = q//;
225 | my $call = q();
226 | 
227 | @data ==> grep {/<[aeiouy]>/} ==> is($(*), $(@out), 'basic test for $(*)');
228 | 
229 | sub is-cool {
230 | }
231 | 
232 | sub q {
233 | }
234 | 
235 | =begin foo-bar
236 | 
237 | bla
238 | 
239 | =end foo-bar
240 | 
241 | @foo».++;
242 | 
243 | $foo.^method
244 | 
245 | say Buf.new("127.0.0.1".split(".")).unpack("N")
246 | 
247 | [&sprintf]
248 | X[&sprintf]
249 | $foo, $, $bar = @bla;
250 | $foo, @, $bar = @bla;
251 | 
252 | isa_ok NaN + 1i, Complex, "NaN + 1i is a Complex number";
253 | ok NaN + 1i ~~ NaN, "NaN + 1i ~~ NaN";
254 | ok NaN ~~ NaN + 1i, "NaN ~~ NaN + 1i";
255 | 
256 | my $str = "bla bla &is-cool() yes";
257 | 
258 | class Foo-Bar {
259 |     method bla { say "foo" }
260 | }
261 | 
262 | class Bla'Bla {
263 |     method boo { say "bar" }
264 | }
265 | 
266 | Inf, -Inf, NaN, +Inf
267 | 
268 | # old-style octals are bad
269 | "\10"
270 | "\123"
271 | # ascii nul is ok though
272 | "\040"
273 | 
274 | for ('/foo/bar/baz/' ~~ m/^ $<dirname>=(.* '/'+)? $<basename>=(<-[\/]>+) '/'* $ /).gist.lines {
275 |     %count{$0}++ if / ^ \s+ (\w+) \s+ '=>' /;   ## extract key
276 | };
277 | throws_like "my Int a = 10;", X::Syntax::Malformed, message => / sigilless /;
278 | 
279 | $foo ~~ S/foo/bar/;
280 | 
281 | my()
282 | BEGIN()
283 | 
284 | # vim: ft=raku
285 | 
286 | 287 | 288 | 289 | -------------------------------------------------------------------------------- /t_source/raku/comments.t: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | #` dfsdfsdf 4 | 5 | say 2+2#`( 6 | dsfsdfsdfsdf ) +3; 7 | 8 | # bar 9 | say "foo"; 10 | 11 | #={ 12 | long 13 | } 14 | #|<< 15 | comment 16 | >> 17 | 18 | #`« 19 | long comment 20 | is long >>foo» 21 | 22 | #`{{ 23 | bla {{foo}} bla }} foo() 24 | 25 | foo 26 | # TODO: foo 27 | 28 | #`[[[ 29 | say "this is a comment"; 30 | #]]] 31 | say "this is executable code"; 32 | 33 | # vim: ft=raku 34 | -------------------------------------------------------------------------------- /t_source/raku/comments.t.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [untitled] 5 | 6 | 7 | 8 | 9 |
# foo
10 | 
11 | #` dfsdfsdf
12 | 
13 | say 2+2#`(
14 | dsfsdfsdfsdf ) +3;
15 | 
16 | # bar
17 | say "foo";
18 | 
19 | #={
20 |  long
21 | }
22 | #|<<
23 |  comment
24 | >>
25 | 
26 | #`«
27 | long comment
28 | is long >>foo»
29 | 
30 | #`{{
31 | bla {{foo}} bla }} foo()
32 | 
33 | foo
34 | # TODO: foo
35 | 
36 | #`[[[
37 |     say "this is a comment";
38 | #]]]
39 | say "this is executable code";
40 | 
41 | # vim: ft=raku
42 | 
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /t_source/raku/grammars.t: -------------------------------------------------------------------------------- 1 | token postfix:sym['->'] () { 2 | '->' 3 | 4 | [ 5 | | <.obs("'->" ~ $.Str ~ "' as postfix dereferencer", "'." ~ $.Str ~ "' or just '" ~ $.Str ~ "' to deref, or whitespace to delimit a pointy block")> 6 | | <.obs('-> as postfix', 'either . to call a method, or whitespace to delimit a pointy block')> 7 | ] 8 | } 9 | 10 | token sibble ($l, $lang2) { 11 | :my ($lang, $start, $stop); 12 | 13 | { my $B = $; ($lang,$start,$stop) = @$B; } 14 | 15 | $start [ $stop || <.panic: "Couldn't find terminator $stop"> ] 16 | [ 17 | <.ws> 18 | [ <.obs('brackets around replacement', 'assignment syntax')> ]? 19 | [ || ] 20 | [ .Str eq '=' || $.[0] }> || <.panic: "Malformed assignment operator"> ] 21 | <.ws> 22 | [ || <.panic: "Assignment operator missing its expression"> ] 23 | ||. 24 | { $lang = $lang2.unbalanced($stop); } 25 | $stop || <.panic: "Malformed replacement part; couldn't find final $stop"> 26 | ] 27 | } 28 | 29 | token TOP { 30 | 31 | 32 | } 33 | 34 | ok('aaab' ~~ / "$!pattern" /, 'Interpolation of instance member'); 35 | ok("\x[c]\x[a]" ~~ m/<[\c[FORM FEED (FF), LINE FEED (LF)]]>/, 'Charclass multiple FORM FEED (FF), LINE FEED (LF)'); 36 | is('aaaaa' ~~ /< a aa aaaa >/, 'aaaa', 'leading whitespace quotes words (tab)'); 37 | 38 | #ok("\c[DIGIT ZERO]" ~~ m/^<:bc>$/, q{Match (European Number)} ); 39 | #ok("abc" ~~ m/a(bc){$0 = uc $0}/, 'Numeric match'); 40 | #ok("abc" ~~ m/a(bc){make uc $0}/ , 'Zero match'); 41 | #'whatever' ~~ /w '>/; 42 | #is('foo456bar' ~~ /foo <(\d+ bar/, '456bar', '<( match'); 43 | #is('foo123bar' ~~ /foo <( bar || ....../, 'foo123', '<( in backtracking'); 44 | #is('foo123bar' ~~ /foo <( 123 [ <( xyz ]?/, '123', 'multiple <( backtracking'); 45 | #ok(!( "a" ~~ m/(<[a..z]-[aeiou]>)/ ), 'Difference set failure'); 46 | #ok(!('a0' ~~ m/$aref[0]/), 'Array ref stringifies before matching'); #OK 47 | #ok(!( "abcd f" ~~ m/abc f>/ ), 'Negative lookahead failure'); 48 | 49 | # vim: ft=raku 50 | -------------------------------------------------------------------------------- /t_source/raku/grammars.t.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [untitled] 5 | 6 | 7 | 8 | 9 |
token postfix:sym['->'] () { 
10 |     '->'
11 |     <!{ $*QSIGIL }>
12 |     [
13 |     | <brack=[ [ { ( ]> <.obs("'->" ~ $<brack>.Str ~ "' as postfix dereferencer", "'." ~ $<brack>.Str ~ "' or just '" ~ $<brack>.Str ~ "' to deref, or whitespace to delimit a pointy block")>
14 |     | <.obs('-> as postfix', 'either . to call a method, or whitespace to delimit a pointy block')>
15 |     ]
16 | }
17 | 
18 | token sibble ($l, $lang2) {
19 |     :my ($lang, $start, $stop);
20 |     <babble($l)>
21 |     { my $B = $<babble><B>; ($lang,$start,$stop) = @$B; }
22 | 
23 |     $start <left=.nibble($lang)> [ $stop || <.panic: "Couldn't find terminator $stop"> ]
24 |     [ <?{ $start ne $stop }>
25 |         <.ws>
26 |         [ <?[ [ { ( < ]> <.obs('brackets around replacement', 'assignment syntax')> ]?
27 |         [ <infixish> || <panic: "Missing assignment operator"> ]
28 |         [ <?{ $<infixish>.Str eq '=' || $<infixish>.<infix_postfix_meta_operator>[0] }> || <.panic: "Malformed assignment operator"> ]
29 |         <.ws>
30 |         [ <right=EXPR(item %item_assignment)> || <.panic: "Assignment operator missing its expression"> ]
31 |     ||.
32 |         { $lang = $lang2.unbalanced($stop); }
33 |         <right=.nibble($lang)> $stop || <.panic: "Malformed replacement part; couldn't find final $stop">
34 |     ]
35 | }
36 | 
37 | token TOP {
38 |     <fred(1)>
39 |     <fred: 2, 3>
40 | }
41 | 
42 | ok('aaab' ~~ / "$!pattern" /, 'Interpolation of instance member');
43 | ok("\x[c]\x[a]" ~~ m/<[\c[FORM FEED (FF), LINE FEED (LF)]]>/, 'Charclass multiple FORM FEED (FF), LINE FEED (LF)');
44 | is('aaaaa' ~~ /<	a aa aaaa >/, 'aaaa', 'leading whitespace quotes words (tab)');
45 | 
46 | #ok("\c[DIGIT ZERO]" ~~ m/^<:bc<EN>>$/, q{Match (European Number)} );
47 | #ok("abc" ~~ m/a(bc){$0 = uc $0}/, 'Numeric match');
48 | #ok("abc" ~~ m/a(bc){make uc $0}/ , 'Zero match');
49 | #'whatever' ~~ /w <test complicated . regex '<goes here>'>/;
50 | #is('foo456bar' ~~ /foo <(\d+ bar/, '456bar', '<( match');
51 | #is('foo123bar' ~~ /foo <( bar || ....../, 'foo123', '<( in backtracking');
52 | #is('foo123bar' ~~ /foo <( 123 [ <( xyz ]?/, '123', 'multiple <( backtracking');
53 | #ok(!( "a" ~~ m/(<[a..z]-[aeiou]>)/ ), 'Difference set failure');
54 | #ok(!('a0' ~~ m/$aref[0]/), 'Array ref stringifies before matching'); #OK
55 | #ok(!( "abcd f" ~~ m/abc <!before d <.ws> f>/ ), 'Negative lookahead failure');
56 | 
57 | # vim: ft=raku
58 | 
59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /t_source/raku/metaops.t: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | is 4 Rcmp 5, 5 cmp 4, "4 Rcmp 5"; 4 | isa_ok 4 Rcmp 5, (5 cmp 4).WHAT, "4 Rcmp 5 is the same type as 5 cmp 4"; 5 | is 4.3 Rcmp 5, 5 cmp 4.3, "4.3 Rcmp 5"; 6 | isa_ok 4.3 Rcmp 5, (5 cmp 4.3).WHAT, "4.3 Rcmp 5 is the same type as 5 cmp 4.3"; 7 | is 4.3 Rcmp 5.Num, 5.Num cmp 4.3, "4.3 Rcmp 5.Num"; 8 | isa_ok 4.3 Rcmp 5.Num, (5.Num cmp 4.3).WHAT, "4.3 Rcmp 5.Num is the same type as 5.Num cmp 4.3"; 9 | is 4.3i Rcmp 5.Num, 5.Num cmp 4.3i, "4.3i Rcmp 5.Num"; 10 | isa_ok 4.3i Rcmp 5.Num, (5.Num cmp 4.3i).WHAT, "4.3i Rcmp 5.Num is the same type as 5.Num cmp 4.3i"; 11 | 12 | is 4 R+ 5, 5 + 4, "4 R+ 5"; 13 | isa_ok 4 R+ 5, (5 + 4).WHAT, "4 R+ 5 is the same type as 5 + 4"; 14 | is 4 R- 5, 5 - 4, "4 R- 5"; 15 | isa_ok 4 R- 5, (5 - 4).WHAT, "4 R- 5 is the same type as 5 - 4"; 16 | is 4 R* 5, 5 * 4, "4 R* 5"; 17 | isa_ok 4 R* 5, (5 * 4).WHAT, "4 R* 5 is the same type as 5 * 4"; 18 | is 4 R/ 5, 5 / 4, "4 R/ 5"; 19 | isa_ok 4 R/ 5, (5 / 4).WHAT, "4 R/ 5 is the same type as 5 / 4"; 20 | is 4 Rdiv 5, 5 div 4, "4 Rdiv 5"; 21 | isa_ok 4 Rdiv 5, (5 div 4).WHAT, "4 Rdiv 5 is the same type as 5 div 4"; 22 | is 4 R% 5, 5 % 4, "4 R% 5"; 23 | isa_ok 4 R% 5, (5 % 4).WHAT, "4 R% 5 is the same type as 5 % 4"; 24 | is 4 R** 5, 5 ** 4, "4 R** 5"; 25 | isa_ok 4 R** 5, (5 ** 4).WHAT, "4 R** 5 is the same type as 5 ** 4"; 26 | 27 | is 4 R< 5, 5 < 4, "4 R< 5"; 28 | isa_ok 4 R< 5, (5 < 4).WHAT, "4 R< 5 is the same type as 5 < 4"; 29 | is 4 R> 5, 5 > 4, "4 R> 5"; 30 | isa_ok 4 R> 5, (5 > 4).WHAT, "4 R> 5 is the same type as 5 > 4"; 31 | is 4 R== 5, 5 == 4, "4 R== 5"; 32 | isa_ok 4 R== 5, (5 == 4).WHAT, "4 R== 5 is the same type as 5 == 4"; 33 | is 4 Rcmp 5, 5 cmp 4, "4 Rcmp 5"; 34 | isa_ok 4 Rcmp 5, (5 cmp 4).WHAT, "4 Rcmp 5 is the same type as 5 cmp 4"; 35 | 36 | is 3 R/ 9 + 5, 8, 'R/ gets precedence of /'; 37 | is 4 R- 5 R/ 10, -2, "Rop gets the precedence of op"; 38 | is (9 R... 1, 3), (1, 3, 5, 7, 9), "Rop gets list_infix precedence correctly"; 39 | 40 | 41 | { 42 | @r = (1, 2, 3) »+« (2, 4, 6); 43 | @e = (3, 6, 9); 44 | is(~@r, ~@e, "hyper-sum two arrays"); 45 | 46 | @r = (1, 2, 3) »-« (2, 4, 6); 47 | @e = (-1, -2, -3); 48 | is(~@r, ~@e, "hyper-subtract two arrays"); 49 | 50 | @r = (1, 2, 3) »*« (2, 4, 6); 51 | @e = (2, 8, 18); 52 | is(~@r, ~@e, "hyper-multiply two arrays"); 53 | 54 | @r = (1, 2, 3) »x« (3, 2, 1); 55 | @e = ('111', '22', '3'); 56 | is(~@r, ~@e, "hyper-x two arrays"); 57 | 58 | @r = (1, 2, 3) »xx« (3, 2, 1); 59 | @e = ((1,1,1), (2,2), (3)); 60 | is(~@r, ~@e, "hyper-xx two arrays"); 61 | 62 | @r = (20, 40, 60) »div« (2, 5, 10); 63 | @e = (10, 8, 6); 64 | is(~@r, ~@e, "hyper-divide two arrays"); 65 | 66 | @r = (1, 2, 3) »+« (10, 20, 30) »*« (2, 3, 4); 67 | @e = (21, 62, 123); 68 | is(~@r, ~@e, "precedence - »+« vs »*«"); 69 | } 70 | 71 | { 72 | @r = (1, 2, 3) >>+<< (2, 4, 6); 73 | @e = (3, 6, 9); 74 | is(~@r, ~@e, "hyper-sum two arrays ASCII notation"); 75 | 76 | @r = (1, 2, 3) >>-<< (2, 4, 6); 77 | @e = (-1, -2, -3); 78 | is(~@r, ~@e, "hyper-subtract two arrays ASCII notation"); 79 | 80 | @r = (1, 2, 3) >>*<< (2, 4, 6); 81 | @e = (2, 8, 18); 82 | is(~@r, ~@e, "hyper-multiply two arrays ASCII notation"); 83 | 84 | @r = (1, 2, 3) >>x<< (3, 2, 1); 85 | @e = ('111', '22', '3'); 86 | is(~@r, ~@e, "hyper-x two arrays ASCII notation"); 87 | 88 | @r = (1, 2, 3) >>xx<< (3, 2, 1); 89 | @e = ((1,1,1), (2,2), (3)); 90 | is(~@r, ~@e, "hyper-xx two arrays ASCII notation"); 91 | 92 | @r = (20, 40, 60) >>div<< (2, 5, 10); 93 | @e = (10, 8, 6); 94 | is(~@r, ~@e, "hyper-divide two arrays ASCII notation"); 95 | 96 | @r = (1, 2, 3) >>+<< (10, 20, 30) >>*<< (2, 3, 4); 97 | @e = (21, 62, 123); 98 | is(~@r, ~@e, "precedence - >>+<< vs >>*<< ASCII notation"); 99 | }; 100 | 101 | { # unary postfix 102 | my @r = (1, 2, 3); 103 | @r»++; 104 | my @e = (2, 3, 4); 105 | is(~@r, ~@e, "hyper auto increment an array"); 106 | 107 | @r = (1, 2, 3); 108 | @r>>++; 109 | @e = (2, 3, 4); 110 | is(~@r, ~@e, "hyper auto increment an array ASCII notation"); 111 | }; 112 | 113 | { # unary prefix 114 | my @r; 115 | @r = -« (3, 2, 1); 116 | my @e = (-3, -2, -1); 117 | is(~@r, ~@e, "hyper op on assignment/pipeline"); 118 | 119 | @r = -<< (3, 2, 1); 120 | @e = (-3, -2, -1); 121 | is(~@r, ~@e, "hyper op on assignment/pipeline ASCII notation"); 122 | }; 123 | 124 | { # dimension upgrade - ASCII 125 | my @r; 126 | @r = (1, 2, 3) >>+>> 1; 127 | my @e = (2, 3, 4); 128 | is(~@r, ~@e, "auto dimension upgrade on rhs ASCII notation"); 129 | 130 | @r = 2 <<*<< (10, 20, 30); 131 | @e = (20, 40, 60); 132 | is(~@r, ~@e, "auto dimension upgrade on lhs ASCII notation"); 133 | } 134 | 135 | { # extension 136 | @r = (1,2,3,4) >>~>>
; 137 | @e = <1A 2B 3C 4D>; 138 | is(~@r, ~@e, "list-level element truncate on rhs ASCII notation"); 139 | 140 | @r = (1,2,3,4,5) <<~<< ; 141 | @e = <1A 2B 3C 4D>; 142 | is(~@r, ~@e, "list-level element truncate on lhs ASCII notation"); 143 | 144 | @r = (1,2,3,4) >>~>> ; 145 | @e = <1A 2B 3C 4A>; 146 | is(~@r, ~@e, "list-level element extension on rhs ASCII notation"); 147 | 148 | @r = (1,2,3) <<~<< ; 149 | @e = <1A 2B 3C 1D>; 150 | is(~@r, ~@e, "list-level element extension on lhs ASCII notation"); 151 | 152 | @r = (1,2,3,4) >>~>> ; 153 | @e = <1A 2B 3A 4B>; 154 | is(~@r, ~@e, "list-level element extension on rhs ASCII notation"); 155 | 156 | @r = (1,2) <<~<< ; 157 | @e = <1A 2B 1C 2D>; 158 | is(~@r, ~@e, "list-level element extension on lhs ASCII notation"); 159 | 160 | @r = (1,2,3,4) >>~>> ; 161 | @e = <1A 2A 3A 4A>; 162 | is(~@r, ~@e, "list-level element extension on rhs ASCII notation"); 163 | 164 | @r = (1,) <<~<< ; 165 | @e = <1A 1B 1C 1D>; 166 | is(~@r, ~@e, "list-level element extension on lhs ASCII notation"); 167 | 168 | @r = (1,2,3,4) >>~>> 'A'; 169 | @e = <1A 2A 3A 4A>; 170 | is(~@r, ~@e, "scalar element extension on rhs ASCII notation"); 171 | 172 | @r = 1 <<~<< ; 173 | @e = <1A 1B 1C 1D>; 174 | is(~@r, ~@e, "scalar element extension on lhs ASCII notation"); 175 | }; 176 | 177 | { # dimension upgrade - unicode 178 | @r = (1,2,3,4) »~» ; 179 | @e = <1A 2B 3C 4D>; 180 | is(~@r, ~@e, "list-level element truncate on rhs unicode notation"); 181 | 182 | @r = (1,2,3,4,5) «~« ; 183 | @e = <1A 2B 3C 4D>; 184 | is(~@r, ~@e, "list-level element truncate on lhs unicode notation"); 185 | 186 | @r = (1,2,3,4) »~» ; 187 | @e = <1A 2B 3C 4A>; 188 | is(~@r, ~@e, "list-level element extension on rhs unicode notation"); 189 | 190 | @r = (1,2,3) «~« ; 191 | @e = <1A 2B 3C 1D>; 192 | is(~@r, ~@e, "list-level element extension on lhs unicode notation"); 193 | 194 | @r = (1,2,3,4) »~» ; 195 | @e = <1A 2B 3A 4B>; 196 | is(~@r, ~@e, "list-level element extension on rhs unicode notation"); 197 | 198 | @r = (1,2) «~« ; 199 | @e = <1A 2B 1C 2D>; 200 | is(~@r, ~@e, "list-level element extension on lhs unicode notation"); 201 | 202 | @r = (1,2,3,4) »~» ; 203 | @e = <1A 2A 3A 4A>; 204 | is(~@r, ~@e, "list-level element extension on rhs unicode notation"); 205 | 206 | @r = (1,) «~« ; 207 | @e = <1A 1B 1C 1D>; 208 | is(~@r, ~@e, "list-level element extension on lhs unicode notation"); 209 | 210 | @r = (1,2,3,4) »~» 'A'; 211 | @e = <1A 2A 3A 4A>; 212 | is(~@r, ~@e, "scalar element extension on rhs unicode notation"); 213 | 214 | @r = 1 «~« ; 215 | @e = <1A 1B 1C 1D>; 216 | is(~@r, ~@e, "scalar element extension on lhs unicode notation"); 217 | }; 218 | 219 | { # unary postfix with integers 220 | my @r; 221 | @r = (1, 4, 9)».sqrt; 222 | my @e = (1, 2, 3); 223 | is(~@r, ~@e, "method call on integer list elements"); 224 | 225 | @r = (1, 4, 9)>>.sqrt; 226 | @e = (1, 2, 3); 227 | is(~@r, ~@e, "method call on integer list elements (ASCII)"); 228 | } 229 | 230 | { 231 | my (@r, @e); 232 | (@r = (1, 4, 9))»++; 233 | @e = (2, 5, 10); 234 | is(~@r, ~@e, "operator call on integer list elements"); 235 | 236 | (@r = (1, 4, 9)).»++; 237 | is(~@r, ~@e, "operator call on integer list elements (Same thing, dot form)"); 238 | } 239 | 240 | # RT #122342 241 | { 242 | my (@r, @e); 243 | @e = (2, 5, 10); 244 | 245 | (@r = (1, 4, 9)).».++; 246 | is(~@r, ~@e, "postfix operator (dotted form) on integer list elements after unary postfix hyper operator"); 247 | 248 | (@r = (1, 4, 9)).>>.++; 249 | is(~@r, ~@e, "postfix operator (dotted form) on integer list elements after unary postfix hyper operator (ASCII)"); 250 | 251 | (@r = (1, 4, 9))\ .»\ .++; 252 | @e = (2, 5, 10); 253 | is(~@r, ~@e, "postfix operator (dotted form) on integer list elements after unary postfix hyper operator (unspace form)"); 254 | } 255 | 256 | { 257 | my @array = <5 -3 7 0 1 -9>; 258 | my $sum = 5 + -3 + 7 + 0 + 1 + -9; # laziness :) 259 | 260 | is(([+] @array), $sum, "[+] works"); 261 | is(([*] 1,2,3), (1*2*3), "[*] works"); 262 | is(([-] 1,2,3), (1-2-3), "[-] works"); 263 | is(([/] 12,4,3), (12/4/3), "[/] works"); 264 | is(([div] 12,4,3), (12 div 4 div 3), "[div] works"); 265 | is(([**] 2,2,3), (2**2**3), "[**] works"); 266 | is(([%] 13,7,4), (13%7%4), "[%] works"); 267 | is(([mod] 13,7,4), (13 mod 7 mod 4), "[mod] works"); 268 | 269 | is((~ [\+] @array), "5 2 9 9 10 1", "[\\+] works"); 270 | is((~ [\-] 1, 2, 3), "1 -1 -4", "[\\-] works"); 271 | } 272 | 273 | { 274 | is ([~] ), "abcd", "[~] works"; 275 | is (~ [\~] ), "a ab abc abcd", "[\\~] works"; 276 | } 277 | 278 | { 279 | ok ([<] 1, 2, 3, 4), "[<] works (1)"; 280 | nok ([<] 1, 3, 2, 4), "[<] works (2)"; 281 | ok ([>] 4, 3, 2, 1), "[>] works (1)"; 282 | nok ([>] 4, 2, 3, 1), "[>] works (2)"; 283 | ok ([==] 4, 4, 4), "[==] works (1)"; 284 | nok ([==] 4, 5, 4), "[==] works (2)"; 285 | #?niecza 2 skip 'this is parsed as ![=], not good' 286 | ok ([!=] 4, 5, 6), "[!=] works (1)"; 287 | nok ([!=] 4, 4, 4), "[!=] works (2)"; 288 | } 289 | 290 | { 291 | ok (! [eq] ), '[eq] basic sanity (positive)'; 292 | ok ( [eq] ), '[eq] basic sanity (negative)'; 293 | ok ( [ne] ), '[ne] basic sanity (positive)'; 294 | ok (! [ne] ), '[ne] basic sanity (negative)'; 295 | ok ( [lt] ), '[lt] basic sanity (positive)'; 296 | ok (! [lt] ), '[lt] basic sanity (negative)'; 297 | } 298 | 299 | { 300 | my ($x, $y); 301 | #?rakudo todo 'huh?' 302 | ok ( [=:=] $x, $x, $x), '[=:=] basic sanity 1'; 303 | ok (not [=:=] $x, $y, $x), '[=:=] basic sanity 2'; 304 | ok ( [!=:=] $x, $y, $x), '[!=:=] basic sanity (positive)'; 305 | #?rakudo todo 'huh?' 306 | ok (not [!=:=] $y, $y, $x), '[!=:=] basic sanity (negative)'; 307 | $y := $x; 308 | #?rakudo todo 'huh?' 309 | ok ( [=:=] $y, $x, $y), '[=:=] after binding'; 310 | } 311 | 312 | { 313 | my $a = [1, 2]; 314 | my $b = [1, 2]; 315 | 316 | ok ([===] 1, 1, 1, 1), '[===] with literals'; 317 | ok ([===] $a, $a, $a), '[===] with vars (positive)'; 318 | nok ([===] $a, $a, [1, 2]), '[===] with vars (negative)'; 319 | ok ([!===] $a, $b, $a), '[!===] basic sanity (positive)'; 320 | nok ([!===] $a, $b, $b), '[!===] basic sanity (negative)'; 321 | } 322 | 323 | { 324 | is ~ ([\<] 1, 2, 3, 4).map({+$_}), "1 1 1 1", "[\\<] works (1)"; 325 | is ~ ([\<] 1, 3, 2, 4).map({+$_}), "1 1 0 0", "[\\<] works (2)"; 326 | is ~ ([\>] 4, 3, 2, 1).map({+$_}), "1 1 1 1", "[\\>] works (1)"; 327 | is ~ ([\>] 4, 2, 3, 1).map({+$_}), "1 1 0 0", "[\\>] works (2)"; 328 | is ~ ([\==] 4, 4, 4).map({+$_}), "1 1 1", "[\\==] works (1)"; 329 | is ~ ([\==] 4, 5, 4).map({+$_}), "1 0 0", "[\\==] works (2)"; 330 | #?niecza 2 todo 'this is parsed as ![=], not good' 331 | is ~ ([\!=] 4, 5, 6).map({+$_}), "1 1 1", "[\\!=] works (1)"; 332 | is ~ ([\!=] 4, 5, 5).map({+$_}), "1 1 0", "[\\!=] works (2)"; 333 | is (~ [\**] 1, 2, 3), "3 8 1", "[\\**] (right assoc) works (1)"; 334 | is (~ [\**] 3, 2, 0), "0 1 3", "[\\**] (right assoc) works (2)"; 335 | } 336 | 337 | # RT #76110 338 | { 339 | is ~([\+] [\+] 1 xx 5), '1 3 6 10 15', 'two nested [\+]'; 340 | #?niecza todo 'unary [] does not context yet' 341 | is ([+] [1, 2, 3, 4]), 4, '[+] does not flatten []-arrays'; 342 | } 343 | 344 | #?niecza skip '[macro]' 345 | { 346 | my @array = (Mu, Mu, 3, Mu, 5); 347 | is ([//] @array), 3, "[//] works"; 348 | is ([orelse] @array), 3, "[orelse] works"; 349 | } 350 | 351 | #?niecza skip '[macro]' 352 | { 353 | my @array = (Mu, Mu, 0, 3, Mu, 5); 354 | is ([||] @array), 3, "[||] works"; 355 | is ([or] @array), 3, "[or] works"; 356 | 357 | # Mu as well as [//] should work too, but testing it like 358 | # this would presumably emit warnings when we have them. 359 | is (~ [\||] 0, 0, 3, 4, 5), "0 0 3 3 3", "[\\||] works"; 360 | } 361 | 362 | # vim: ft=raku 363 | -------------------------------------------------------------------------------- /t_source/raku/pod.t: -------------------------------------------------------------------------------- 1 | =foobar 2 | sdfsdfsdf 3 | 4 | =for code 5 | sdfsdfsdf 6 | 7 | =foobar 8 | sdfsdfsdf 9 | 10 | =for foo 11 | sdfsdfsdfsdf 12 | 13 | =begin code 14 | foo() + $bar 15 | 16 | =end code 17 | 18 | # TODO: 'foobar' would be incorrectly highlighted as code because 19 | # the highlighting of implicit code doesn't care about the indent 20 | # level of the Pod block 21 | #=begin pod 22 | #foobar 23 | #=end pod 24 | #=pod 25 | #foobar 26 | 27 | =begin bla 28 | foo 29 | bar 30 | =end bla 31 | 32 | =begin pod 33 | foo 34 | bar 35 | =end pod 36 | 37 | =begin foo :nested(3) 38 | and so, all of the villages chased 39 | Albi, The Racist Dragon, into the 40 | very cold and very scary cave 41 | 42 | and it was so cold and so scary in 43 | there, that Albi began to cry 44 | 45 | =for bar 46 | Dragon Tears! 47 | 48 | Which, as we all know... 49 | 50 | =for bar 51 | Turn into Jelly Beans! 52 | =end foo 53 | 54 | =begin bla 55 | 56 | =code 57 | 3+3 58 | foo 59 | 60 | foo 61 | 62 | =end bla 63 | 64 | =code 65 | sdfgdfgdfg 66 | 67 | bar 68 | 69 | # vim: ft=raku 70 | -------------------------------------------------------------------------------- /t_source/raku/pod.t.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [untitled] 5 | 6 | 7 | 8 | 9 |
=foobar
10 | sdfsdfsdf
11 | 
12 |     =for code
13 |     sdfsdfsdf
14 | 
15 |     =foobar
16 |     sdfsdfsdf
17 | 
18 |     =for foo
19 |     sdfsdfsdfsdf
20 | 
21 |     =begin code
22 |     foo() + $bar
23 | 
24 |     =end code
25 | 
26 |     # TODO: 'foobar' would be incorrectly highlighted as code because
27 |     # the highlighting of implicit code doesn't care about the indent
28 |     # level of the Pod block
29 |     #=begin pod
30 |     #foobar
31 |     #=end pod
32 |     #=pod
33 |     #foobar
34 | 
35 | =begin bla
36 | foo
37 |     bar
38 | =end bla
39 | 
40 | =begin pod
41 | foo
42 |     bar
43 | =end pod
44 | 
45 | =begin foo :nested(3)
46 | and so,  all  of  the  villages chased
47 | Albi,   The   Racist  Dragon, into the
48 | very   cold   and  very  scary    cave
49 | 
50 | and it was so cold and so scary in
51 | there,  that  Albi  began  to  cry
52 | 
53 |     =for bar
54 |     Dragon Tears!
55 | 
56 | Which, as we all know...
57 | 
58 |     =for bar
59 |     Turn into Jelly Beans!
60 | =end foo
61 | 
62 | =begin bla
63 | 
64 | =code
65 | 3+3
66 | foo
67 | 
68 | foo
69 | 
70 | =end bla
71 | 
72 |     =code
73 |     sdfgdfgdfg
74 | 
75 | bar
76 | 
77 | # vim: ft=raku
78 | 
79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /t_source/raku/quoting.t: -------------------------------------------------------------------------------- 1 | 2 | my $double = qq/foo $bar @baz[] bla/; 3 | my $ex = qqx{foo $bar}; 4 | qx//; 5 | q// 6 | qw«hey there» 7 | qww 8 | 9 | my $hlagh = qq[foo bar $baz] 10 | my $hlagh = q[foo bar $baz] 11 | 12 | my $here = qto/foo/; 13 | dsfsdfsdf 14 | foo 15 | say $here; 16 | 17 | my $heredoc = qqto/foo bar/; 18 | dsfdsfsdfdsf 19 | dsfsdfsdfsd 20 | $foo 21 | sdfsdfsdfds 22 | foo bar 23 | 24 | my %hih; 25 | 26 | my @empty = <>; 27 | my @empty = < >; 28 | 29 | 30 | my $here = qq:to/GOO/ 31 | SDFSDF 32 | sdfsdfsdf 33 | sdfsdf 34 | GOO 35 | 36 | my $str = q:foo:heredoc:bar/bla/ 37 | dfgdfgdfg 38 | dfg 39 | bla 40 | 41 | my $str = q:heredoc/bla/ 42 | dfgdfgdfg 43 | dfg 44 | bla 45 | 46 | say qq :to 'TEXT'; 47 | Wow, this is $description! 48 | TEXT 49 | 50 | say qq 51 | :to 'TEXT'; 52 | Wow, this is $description! 53 | TEXT 54 | 55 | Q{\} 56 | Q{\\} 57 | 58 | Qto; 59 | fsd 60 | fsdfsdf foo 61 | sdfsdfsd 62 | foo 63 | 3+3 64 | 65 | # vim: ft=raku 66 | -------------------------------------------------------------------------------- /t_source/raku/quoting.t.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [untitled] 5 | 6 | 7 | 8 | 9 |
10 | my $double = qq/foo $bar @baz[] bla/;
11 | my $ex = qqx{foo $bar};
12 | qx//;
13 | q//
14 | qw«hey there»
15 | qww<yes 'no' foo>
16 | 
17 | my $hlagh = qq[foo bar $baz]
18 | my $hlagh = q[foo bar $baz]
19 | 
20 | my $here = qto/foo/;
21 | dsfsdfsdf
22 | foo
23 | say $here;
24 | 
25 | my $heredoc = qqto/foo bar/;
26 |     dsfdsfsdfdsf
27 |     dsfsdfsdfsd
28 |     $foo
29 |         sdfsdfsdfds
30 |     foo bar
31 | 
32 | my %hih;
33 | 
34 | my @empty = <>;
35 | my @empty = < >;
36 | 
37 | 
38 | my $here = qq:to/GOO/
39 | SDFSDF
40 | sdfsdfsdf
41 | sdfsdf
42 | GOO
43 | 
44 | my $str = q:foo:heredoc:bar/bla/
45 | dfgdfgdfg
46 | dfg
47 | bla
48 | 
49 | my $str = q:heredoc/bla/
50 | dfgdfgdfg
51 | dfg
52 | bla
53 | 
54 | say qq :to 'TEXT';
55 |     Wow, this is $description!
56 |     TEXT
57 | 
58 | say qq
59 | :to 'TEXT';
60 |     Wow, this is $description!
61 |     TEXT
62 | 
63 | Q{\}
64 | Q{\\}
65 | 
66 | Qto<foo>;
67 | fsd
68 | fsdfsdf foo
69 | sdfsdfsd
70 | foo
71 | 3+3
72 | 
73 | # vim: ft=raku
74 | 
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /tools/preproc.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | 5 | # This script is used to preprocess the raku syntax file to reduce 6 | # repetition of common patterns. VimL requires cumbersome string 7 | # concatenation and eval to reuse patterns, which makes for a lot of 8 | # boilerplate code and a less readable regexes. So instead we preprocess 9 | # the file to keep the original source more readable and easier to edit. 10 | # 11 | # A "macro" is defined by including lines in the source file which start 12 | # with the VimL comment character (") followed by an identifier name 13 | # surrounded by two sets of at-signs (@@FOO@@). This is followed by 14 | # whitespace and then a double or single-quoted string containing the 15 | # replacement text. Earlier macros can be interpolated into later macros. 16 | 17 | my $preproc = '@@'; 18 | my %replacements; 19 | while (my $line = <>) { 20 | my $check_line = $line; 21 | while ($check_line =~ /$preproc/) { 22 | $check_line = substr($check_line, $+[0]); 23 | if ($check_line !~ /^\w+$preproc/) { 24 | warn "Missing '$preproc' on line $.\n"; 25 | } 26 | else { 27 | $check_line = substr($check_line, $+[0]); 28 | } 29 | } 30 | 31 | if ($line =~ /^"\s*$preproc(\w+)$preproc\s+(?:(.)(.+)\2)\s*$/) { 32 | my ($name, $content) = ($1, $3); 33 | $content =~ s/$preproc(\w+)$preproc/ 34 | die "Replacement for $preproc$1$preproc not found at line $.\n" if !$replacements{$1}; 35 | $replacements{$1} 36 | /eg; 37 | $replacements{$name} = $content; 38 | } 39 | else { 40 | $line =~ s/$preproc(\w+)$preproc/ 41 | die "Replacement for $preproc$1$preproc not found at line $.\n" if !$replacements{$1}; 42 | $replacements{$1} 43 | /eg; 44 | } 45 | print $line; 46 | } 47 | --------------------------------------------------------------------------------