# HG changeset patch # User Bram Moolenaar # Date 1619021704 -7200 # Node ID 5bda4653acedb82fcd97b4ed670fad9e76c15ea9 # Parent da748a66a65afb0c977c30c52c4699559616dc3a Update runtime files Commit: https://github.com/vim/vim/commit/11e3c5ba820325b69cb56f70e13c21d7b8808d33 Author: Bram Moolenaar Date: Wed Apr 21 18:09:37 2021 +0200 Update runtime files diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile --- a/runtime/doc/Makefile +++ b/runtime/doc/Makefile @@ -31,6 +31,7 @@ DOCS = \ fold.txt \ ft_ada.txt \ ft_ps1.txt \ + ft_raku.txt \ ft_rust.txt \ ft_sql.txt \ gui.txt \ @@ -175,6 +176,7 @@ HTMLS = \ fold.html \ ft_ada.html \ ft_ps1.html \ + ft_raku.html \ ft_rust.html \ ft_sql.html \ gui.html \ diff --git a/runtime/doc/ft_raku.txt b/runtime/doc/ft_raku.txt new file mode 100644 --- /dev/null +++ b/runtime/doc/ft_raku.txt @@ -0,0 +1,126 @@ +*vim-raku.txt* The Raku programming language filetype + + *vim-raku* + +Vim-raku provides syntax highlighting, indentation, and other support for +editing Raku programs. + +1. Using Unicode in your Raku files |raku-unicode| + +============================================================================== +1. Using Unicode in your Raku files *raku-unicode* + +Defining new operators using Unicode symbols is a good way to make your +Raku program easy to read. See: +https://perl6advent.wordpress.com/2012/12/18/day-18-formulas-resistance-is-futile/ + +While Raku does define ASCII alternatives for some common operators (see +https://docs.raku.org/language/unicode_ascii), using the full range of +Unicode operators is highly desirable. Your operating system provides input +facilities, but using the features built in to Vim may be preferable. + +The natural way to produce these symbols in Vim is to use digraph shortcuts +(:help |digraphs-use|). Many of them are defined; type `:digraphs` to get +the list. A convenient way to read the list of digraphs is to save them in a +file. From the shell: > + vim +'redir >/tmp/vim-digraphs-listing.txt' +digraphs +'redir END' +q + +Some of them are available with standard Vim digraphs: + << « /0 ∅ !< ≮ ~ + >> » Ob ∘ !> ≯ ~ + ., … 00 ∞ (C ⊂ ~ + (U ∩ -: ÷ )C ⊃ ~ + )U ∪ (_ ⊆ >= ≥ ~ + ?= ≅ )_ ⊇ =< ≤ ~ + (- ∈ ?= ≅ != ≠ ~ + -) ∋ ?- ≃ ~ + +The Greek alphabet is available with '*' followed by a similar Latin symbol: + *p π ~ + *t τ ~ + *X × ~ + +Numbers, subscripts and superscripts are available with 's' and 'S': + 0s ₀ 0S ⁰ ~ + 1s ₁ 1S ¹ ~ + 2s ₂ 9S ⁹ ~ + +But some don´t come defined by default. Those are digraph definitions you can +add in your ~/.vimrc file. > + exec 'digraph \\ '.char2nr('∖') + exec 'digraph \< '.char2nr('≼') + exec 'digraph \> '.char2nr('≽') + exec 'digraph (L '.char2nr('⊈') + exec 'digraph )L '.char2nr('⊉') + exec 'digraph (/ '.char2nr('⊄') + exec 'digraph )/ '.char2nr('⊅') + exec 'digraph )/ '.char2nr('⊅') + exec 'digraph U+ '.char2nr('⊎') + exec 'digraph 0- '.char2nr('⊖') + " Euler's constant + exec 'digraph ne '.char2nr('𝑒') + " Raku's atomic operations marker + exec 'digraph @@ '.char2nr('⚛') + +Alternatively, you can write Insert mode abbreviations that convert ASCII- +based operators into their single-character Unicode equivalent. > + iabbrev !(<) ⊄ + iabbrev !(<=) ⊈ + iabbrev !(>) ⊅ + iabbrev !(>=) ⊉ + iabbrev !(cont) ∌ + iabbrev !(elem) ∉ + iabbrev != ≠ + iabbrev (&) ∩ + iabbrev (+) ⊎ + iabbrev (-) ∖ + iabbrev (.) ⊍ + iabbrev (<) ⊂ + iabbrev (<+) ≼ + iabbrev (<=) ⊆ + iabbrev (>) ⊃ + iabbrev (>+) ≽ + iabbrev (>=) ⊇ + iabbrev (\|) ∪ + iabbrev (^) ⊖ + iabbrev (atomic) ⚛ + iabbrev (cont) ∋ + iabbrev (elem) ∈ + iabbrev * × + iabbrev **0 ⁰ + iabbrev **1 ¹ + iabbrev **2 ² + iabbrev **3 ³ + iabbrev **4 ⁴ + iabbrev **5 ⁵ + iabbrev **6 ⁶ + iabbrev **7 ⁷ + iabbrev **8 ⁸ + iabbrev **9 ⁹ + iabbrev ... … + iabbrev / ÷ + iabbrev << « + iabbrev <<[=]<< «=« + iabbrev <<[=]>> «=» + iabbrev <= ≤ + iabbrev =~= ≅ + iabbrev >= ≥ + iabbrev >> » + iabbrev >>[=]<< »=« + iabbrev >>[=]>> »=» + iabbrev Inf ∞ + iabbrev atomic-add-fetch ⚛+= + iabbrev atomic-assign ⚛= + iabbrev atomic-fetch ⚛ + iabbrev atomic-dec-fetch --⚛ + iabbrev atomic-fetch-dec ⚛-- + iabbrev atomic-fetch-inc ⚛++ + iabbrev atomic-inc-fetch ++⚛ + iabbrev atomic-sub-fetch ⚛−= + iabbrev e 𝑒 + iabbrev o ∘ + iabbrev pi π + iabbrev set() ∅ + iabbrev tau τ +< + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.2. Last change: 2021 Apr 16 +*options.txt* For Vim version 8.2. Last change: 2021 Apr 17 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/tags b/runtime/doc/tags --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -8718,6 +8718,7 @@ quotestar gui.txt /*quotestar* quote~ change.txt /*quote~* r change.txt /*r* r.vim syntax.txt /*r.vim* +raku-unicode ft_raku.txt /*raku-unicode* rand() eval.txt /*rand()* random eval.txt /*random* range() eval.txt /*range()* @@ -10129,6 +10130,8 @@ vim-dev intro.txt /*vim-dev* vim-mac intro.txt /*vim-mac* vim-modes intro.txt /*vim-modes* vim-modes-intro intro.txt /*vim-modes-intro* +vim-raku ft_raku.txt /*vim-raku* +vim-raku.txt ft_raku.txt /*vim-raku.txt* vim-script-intro usr_41.txt /*vim-script-intro* vim-use intro.txt /*vim-use* vim-variable eval.txt /*vim-variable* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.2. Last change: 2021 Apr 17 +*todo.txt* For Vim version 8.2. Last change: 2021 Apr 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -38,22 +38,7 @@ browser use: https://github.com/vim/vim/ *known-bugs* -------------------- Known bugs and current work ----------------------- -make "skiprtp" also omit 'packpath'? - -- Implement blob index and slice assignment? - Make all of test_blob run in three ways - Vim9 - Make everything work: -- use CheckLegacyAndVim9Success(lines) in many more places -- For builtin functions using tv_get_string*() use check_for_string() to be - more strict about the argument type (not a bool). - done: balloon_() -- Check many more builtin function arguments at compile time. - map() could check that the return type of the function argument matches - the type of the list or dict member. (#8092) -- Compile replacement of :s command: s/pat/\=expr/ -- Compile redir to local variable: var_redir_start(). -- Implement type cast at the script level. - Compile builtin functions that access local variables: islocked() - When evaluating constants for script variables, some functions could work: @@ -70,11 +55,15 @@ Vim9 - Make everything work: - give an error for "echo Func()" if Func() does not return anything. - Using "windo echo expr" does not accept a line break inside "expr" (in a :def function and at script level in a not executed block). #7681 -- "assert_fails()" cannot access local variables. Perhaps add this: - assertfails - ... cmd ... - endassertfails /E99:.*cmd/ - Similar to try/catch/endtry but without the boilerplate. +- use CheckLegacyAndVim9Success(lines) in many more places +- For builtin functions using tv_get_string*() use check_for_string() to be + more strict about the argument type (not a bool). + done: balloon_() +- Check many more builtin function arguments at compile time. + map() could check that the return type of the function argument matches + the type of the list or dict member. (#8092) +- Allow for using an autoload function name without quotes. It is then loaded + (and compiled) right away. #8124 Once Vim9 is stable: - Change the help to prefer Vim9 syntax where appropriate diff --git a/runtime/doc/usr_12.txt b/runtime/doc/usr_12.txt --- a/runtime/doc/usr_12.txt +++ b/runtime/doc/usr_12.txt @@ -1,4 +1,4 @@ -*usr_12.txt* For Vim version 8.2. Last change: 2017 Aug 11 +*usr_12.txt* For Vim version 8.2. Last change: 2021 Apr 19 VIM USER MANUAL - by Bram Moolenaar @@ -180,14 +180,14 @@ after it. That way you don't have this The |:global| command can be combined with the |:move| command to move all the lines before the first line, resulting in a reversed file. The command is: > - :global/^/m 0 + :global/^/move 0 Abbreviated: > :g/^/m 0 The "^" regular expression matches the beginning of the line (even if the line -is blank). The |:move| command moves the matching line to after the mythical +is blank). The |:move| command moves the matching line to after the imaginary zeroth line, so the current matching line becomes the first line of the file. As the |:global| command is not confused by the changing line numbering, |:global| proceeds to match all remaining lines of the file and puts each as diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 8.2. Last change: 2021 Mar 14 +*usr_41.txt* For Vim version 8.2. Last change: 2021 Apr 19 VIM USER MANUAL - by Bram Moolenaar @@ -115,12 +115,20 @@ if you are impatient. FOUR KINDS OF NUMBERS -Numbers can be decimal, hexadecimal, octal or binary. A hexadecimal number -starts with "0x" or "0X". For example "0x1f" is decimal 31. An octal number -starts with a zero. "017" is decimal 15. A binary number starts with "0b" or -"0B". For example "0b101" is decimal 5. Careful: don't put a zero before a -decimal number, it will be interpreted as an octal number! - The ":echo" command always prints decimal numbers. Example: > +Numbers can be decimal, hexadecimal, octal or binary. + +A hexadecimal number starts with "0x" or "0X". For example "0x1f" is decimal +31. + +An octal number starts with "0o", "0O" or a zero and another digit. "0o17" is +decimal 15. Using just a zero prefix is not supported in Vim9 script. + +A binary number starts with "0b" or "0B". For example "0b101" is decimal 5. + +A decimal number is just digits. Careful: don't put a zero before a decimal +number, it will be interpreted as an octal number in legacy script! + +The ":echo" command always prints decimal numbers. Example: > :echo 0x7f 0o36 < 127 30 ~ diff --git a/runtime/ftplugin/perl6.vim b/runtime/ftplugin/perl6.vim deleted file mode 100644 --- a/runtime/ftplugin/perl6.vim +++ /dev/null @@ -1,77 +0,0 @@ -" Vim filetype plugin file -" Language: Perl 6 -" Maintainer: vim-perl -" Homepage: https://github.com/vim-perl/vim-perl -" Bugs/requests: https://github.com/vim-perl/vim-perl/issues -" Last Change: 2020 Apr 15 -" Contributors: Hinrik Örn Sigurðsson -" -" Based on ftplugin/perl.vim by Dan Sharp - -if exists("b:did_ftplugin") | finish | endif -let b:did_ftplugin = 1 - -" Make sure the continuation lines below do not cause problems in -" compatibility mode. -let s:save_cpo = &cpo -set cpo-=C - -setlocal formatoptions-=t -setlocal formatoptions+=crqol -setlocal keywordprg=p6doc - -setlocal comments=:# -setlocal commentstring=#%s - -" Change the browse dialog on Win32 to show mainly Perl-related files -if has("gui_win32") - let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" . - \ "Perl Modules (*.pm)\t*.pm\n" . - \ "Perl Documentation Files (*.pod)\t*.pod\n" . - \ "All Files (*.*)\t*.*\n" -endif - -" Provided by Ned Konz -"--------------------------------------------- -setlocal include=\\<\\(use\\\|require\\)\\> -setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','') -setlocal define=[^A-Za-z_] - -" The following line changes a global variable but is necessary to make -" gf and similar commands work. Thanks to Andrew Pimlott for pointing out -" the problem. If this causes a " problem for you, add an -" after/ftplugin/perl6.vim file that contains -" set isfname-=: -set isfname+=: -setlocal iskeyword=48-57,_,A-Z,a-z,:,- - -" Set this once, globally. -if !exists("perlpath") - if executable("perl6") - try - if &shellxquote != '"' - let perlpath = system('perl6 -e "@*INC.join(q/,/).say"') - else - let perlpath = system("perl6 -e '@*INC.join(q/,/).say'") - endif - let perlpath = substitute(perlpath,',.$',',,','') - catch /E145:/ - let perlpath = ".,," - endtry - else - " If we can't call perl to get its path, just default to using the - " current directory and the directory of the current file. - let perlpath = ".,," - endif -endif - -let &l:path=perlpath -"--------------------------------------------- - -" Undo the stuff we changed. -let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk<" . - \ " | unlet! b:browsefilter" - -" Restore the saved compatibility options. -let &cpo = s:save_cpo -unlet s:save_cpo diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim --- a/runtime/ftplugin/r.vim +++ b/runtime/ftplugin/r.vim @@ -2,7 +2,7 @@ " Language: R " Maintainer: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Tue Apr 07, 2015 04:38PM +" Last Change: Sat Aug 15, 2020 11:37AM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -20,7 +20,7 @@ setlocal formatoptions-=t setlocal commentstring=#\ %s setlocal comments=:#',:###,:##,:# -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R)\t*.R\n" . \ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst)\t*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . \ "All Files (*.*)\t*.*\n" diff --git a/runtime/ftplugin/raku.vim b/runtime/ftplugin/raku.vim new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/raku.vim @@ -0,0 +1,127 @@ +" Vim filetype plugin file +" Language: Raku +" Maintainer: vim-perl +" Homepage: https://github.com/Raku/vim-raku +" Bugs/requests: https://github.com/Raku/vim-raku/issues +" Last Change: 2021-04-16 +" Contributors: Hinrik Örn Sigurðsson +" +" Based on ftplugin/perl.vim by Dan Sharp + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +setlocal formatoptions-=t +setlocal formatoptions+=crqol +setlocal keywordprg=p6doc + +setlocal comments=:#\|,:#=,:# +setlocal commentstring=#%s + +" Provided by Ned Konz +"--------------------------------------------- +setlocal include=\\<\\(use\\\|require\\)\\> +setlocal includeexpr=substitute(v:fname,'::','/','g') +setlocal suffixesadd=.rakumod,.rakudoc,.pm6,.pm +setlocal define=[^A-Za-z_] + +" The following line changes a global variable but is necessary to make +" gf and similar commands work. Thanks to Andrew Pimlott for pointing out +" the problem. If this causes a problem for you, add an +" after/ftplugin/raku.vim file that contains +" set isfname-=: +set isfname+=: +setlocal iskeyword=@,48-57,_,192-255,- + +" Raku exposes its CompUnits through $*REPO, but mapping module names to +" compunit paths is nontrivial. Probably it's more convenient to rely on +" people using zef, which has a handy store of sources for modules it has +" installed. +func s:compareReverseFtime(a, b) + let atime = getftime(a:a) + let btime = getftime(a:b) + return atime > btime ? -1 : atime == btime ? 0 : 1 +endfunc + +let &l:path = "lib,." +if exists('$RAKULIB') + let &l:path = &l:path . "," . $RAKULIB +endif +let &l:path = &l:path . "," . join( + \ sort(glob("~/.zef/store/*/*/lib", 0, 1), "s:compareReverseFtime"), + \ ',') + +" Convert ascii-based ops into their single-character unicode equivalent +if get(g:, 'raku_unicode_abbrevs', 0) + iabbrev !(<) ⊄ + iabbrev !(<=) ⊈ + iabbrev !(>) ⊅ + iabbrev !(>=) ⊉ + iabbrev !(cont) ∌ + iabbrev !(elem) ∉ + iabbrev != ≠ + iabbrev (&) ∩ + iabbrev (+) ⊎ + iabbrev (-) ∖ + iabbrev (.) ⊍ + iabbrev (<) ⊂ + iabbrev (<+) ≼ + iabbrev (<=) ⊆ + iabbrev (>) ⊃ + iabbrev (>+) ≽ + iabbrev (>=) ⊇ + iabbrev (\|) ∪ + iabbrev (^) ⊖ + iabbrev (atomic) ⚛ + iabbrev (cont) ∋ + iabbrev (elem) ∈ + iabbrev * × + iabbrev **0 ⁰ + iabbrev **1 ¹ + iabbrev **2 ² + iabbrev **3 ³ + iabbrev **4 ⁴ + iabbrev **5 ⁵ + iabbrev **6 ⁶ + iabbrev **7 ⁷ + iabbrev **8 ⁸ + iabbrev **9 ⁹ + iabbrev ... … + iabbrev / ÷ + iabbrev << « + iabbrev <<[=]<< «=« + iabbrev <<[=]>> «=» + iabbrev <= ≤ + iabbrev =~= ≅ + iabbrev >= ≥ + iabbrev >> » + iabbrev >>[=]<< »=« + iabbrev >>[=]>> »=» + iabbrev Inf ∞ + iabbrev atomic-add-fetch ⚛+= + iabbrev atomic-assign ⚛= + iabbrev atomic-fetch ⚛ + iabbrev atomic-dec-fetch --⚛ + iabbrev atomic-fetch-dec ⚛-- + iabbrev atomic-fetch-inc ⚛++ + iabbrev atomic-inc-fetch ++⚛ + iabbrev atomic-sub-fetch ⚛−= + iabbrev e 𝑒 + iabbrev o ∘ + iabbrev pi π + iabbrev set() ∅ + iabbrev tau τ +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< isk< kp< path<" . + \ " | unlet! b:browsefilter" + +" Restore the saved compatibility options. +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim --- a/runtime/ftplugin/rhelp.vim +++ b/runtime/ftplugin/rhelp.vim @@ -2,7 +2,7 @@ " Language: R help file " Maintainer: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Tue Apr 07, 2015 04:37PM +" Last Change: Sat Aug 15, 2020 12:01PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -17,7 +17,7 @@ set cpo&vim setlocal iskeyword=@,48-57,_,. -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim --- a/runtime/ftplugin/rmd.vim +++ b/runtime/ftplugin/rmd.vim @@ -2,7 +2,7 @@ " Language: R Markdown file " Maintainer: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Jul 22, 2018 06:51PM +" Last Change: Sat Aug 15, 2020 12:03PM " Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann) " Only do this when not yet done for this buffer @@ -46,7 +46,7 @@ runtime ftplugin/pandoc.vim " Don't load another plugin for this buffer let b:did_ftplugin = 1 -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim --- a/runtime/ftplugin/rnoweb.vim +++ b/runtime/ftplugin/rnoweb.vim @@ -2,7 +2,7 @@ " Language: Rnoweb " Maintainer: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Tue Apr 07, 2015 04:37PM +" Last Change: Sat Aug 15, 2020 12:02PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -24,7 +24,7 @@ setlocal iskeyword=@,48-57,_,. setlocal suffixesadd=.bib,.tex setlocal comments=b:%,b:#,b:##,b:###,b:#' -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim --- a/runtime/ftplugin/rrst.vim +++ b/runtime/ftplugin/rrst.vim @@ -2,7 +2,7 @@ " Language: reStructuredText documentation format with R code " Maintainer: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Wed Nov 01, 2017 10:47PM +" Last Change: Sat Aug 15, 2020 12:02PM " Original work by Alex Zvoleff " Only do this when not yet done for this buffer @@ -37,7 +37,7 @@ if !exists("g:rrst_dynamic_comments") || setlocal formatexpr=FormatRrst() endif -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/indent/perl6.vim b/runtime/indent/raku.vim rename from runtime/indent/perl6.vim rename to runtime/indent/raku.vim --- a/runtime/indent/perl6.vim +++ b/runtime/indent/raku.vim @@ -36,7 +36,7 @@ let b:did_indent = 1 " Is syntax highlighting active ? let b:indent_use_syntax = has("syntax") -setlocal indentexpr=GetPerl6Indent() +setlocal indentexpr=GetRakuIndent() " we reset it first because the Perl 5 indent file might have been loaded due " to a .pl/pm file extension, and indent files don't clean up afterwards @@ -50,7 +50,7 @@ endif let s:cpo_save = &cpo set cpo-=C -function! GetPerl6Indent() +function! GetRakuIndent() " Get the line to be indented let cline = getline(v:lnum) @@ -60,11 +60,6 @@ function! GetPerl6Indent() return 0 endif - " Don't reindent coments on first column - if cline =~ '^#' - return 0 - endif - " Get current syntax item at the line's first char let csynid = '' if b:indent_use_syntax @@ -72,7 +67,7 @@ function! GetPerl6Indent() endif " Don't reindent POD and heredocs - if csynid =~ "^p6Pod" + if csynid =~ "^rakuPod" return indent(v:lnum) endif @@ -92,7 +87,7 @@ function! GetPerl6Indent() let skippin = 2 while skippin let synid = synIDattr(synID(lnum,1,0),"name") - if (synid =~ "^p6Pod" || synid =~ "p6Comment") + if (synid =~ "^rakuPod" || synid =~ "rakuComment") let lnum = prevnonblank(lnum - 1) if lnum == 0 return 0 @@ -107,19 +102,19 @@ function! GetPerl6Indent() endif if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$' - let ind = ind + shiftwidth() + let ind = ind + &sw endif if cline =~ '^\s*[)}\]»>]' - let ind = ind - shiftwidth() + let ind = ind - &sw endif " Indent lines that begin with 'or' or 'and' if cline =~ '^\s*\(or\|and\)\>' if line !~ '^\s*\(or\|and\)\>' - let ind = ind + shiftwidth() + let ind = ind + &sw endif elseif line =~ '^\s*\(or\|and\)\>' - let ind = ind - shiftwidth() + let ind = ind - &sw endif return ind diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim --- a/runtime/indent/rmd.vim +++ b/runtime/indent/rmd.vim @@ -2,7 +2,7 @@ " Language: Rmd " Author: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Aug 19, 2018 09:14PM +" Last Change: Sun Mar 28, 2021 08:05PM " Only load this indent file when no other was loaded. @@ -13,7 +13,7 @@ runtime indent/r.vim let s:RIndent = function(substitute(&indentexpr, "()", "", "")) let b:did_indent = 1 -setlocal indentkeys=0{,0},:,!^F,o,O,e +setlocal indentkeys=0{,0},<:>,!^F,o,O,e setlocal indentexpr=GetRmdIndent() if exists("*GetRmdIndent") @@ -23,6 +23,21 @@ endif let s:cpo_save = &cpo set cpo&vim +" Simple Python indentation algorithm +function s:GetPyIndent() + let plnum = prevnonblank(v:lnum - 1) + let pline = getline(plnum) + let cline = getline(v:lnum) + if pline =~ '^s```\s*{\s*python ' + return 0 + elseif pline =~ ':$' + return indent(plnum) + &shiftwidth + elseif cline =~ 'else:$' + return indent(plnum) - &shiftwidth + endif + return indent(plnum) +endfunction + function s:GetMdIndent() let pline = getline(v:lnum - 1) let cline = getline(v:lnum) @@ -37,13 +52,14 @@ function s:GetMdIndent() endfunction function s:GetYamlIndent() - let pline = getline(v:lnum - 1) + let plnum = prevnonblank(v:lnum - 1) + let pline = getline(plnum) if pline =~ ':\s*$' - return indent(v:lnum) + shiftwidth() + return indent(plnum) + shiftwidth() elseif pline =~ '^\s*- ' return indent(v:lnum) + 2 endif - return indent(prevnonblank(v:lnum - 1)) + return indent(plnum) endfunction function GetRmdIndent() @@ -52,9 +68,11 @@ function GetRmdIndent() endif if search('^[ \t]*```{r', "bncW") > search('^[ \t]*```$', "bncW") return s:RIndent() - elseif v:lnum > 1 && search('^---$', "bnW") == 1 && - \ (search('^---$', "nW") > v:lnum || search('^...$', "nW") > v:lnum) + elseif v:lnum > 1 && (search('^---$', "bnW") == 1 && + \ (search('^---$', "nW") > v:lnum || search('^\.\.\.$', "nW") > v:lnum)) return s:GetYamlIndent() + elseif search('^[ \t]*```{python', "bncW") > search('^[ \t]*```$', "bncW") + return s:GetPyIndent() else return s:GetMdIndent() endif diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim --- a/runtime/indent/vim.vim +++ b/runtime/indent/vim.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Vim script " Maintainer: Bram Moolenaar -" Last Change: 2021 Feb 18 +" Last Change: 2021 Apr 18 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -71,7 +71,8 @@ function GetVimIndentIntern() " End of heredoc: use indent of matching start line let lnum = v:lnum - 1 while lnum > 0 - if synIDattr(synID(lnum, 1, 1), "name") !~ 'vimLetHereDoc' + let attr = synIDattr(synID(lnum, 1, 1), "name") + if attr != '' && attr !~ 'vimLetHereDoc' return indent(lnum) endif let lnum -= 1 diff --git a/runtime/syntax/perl6.vim b/runtime/syntax/perl6.vim deleted file mode 100644 --- a/runtime/syntax/perl6.vim +++ /dev/null @@ -1,2242 +0,0 @@ -" Vim syntax file -" Language: Perl 6 -" Maintainer: vim-perl -" Homepage: https://github.com/vim-perl/vim-perl/tree/master -" Bugs/requests: https://github.com/vim-perl/vim-perl/issues -" Last Change: 2020 Apr 15 - -" Contributors: Luke Palmer -" Moritz Lenz -" Hinrik Örn Sigurðsson -" -" This is a big undertaking. Perl 6 is the sort of language that only Perl -" can parse. But I'll do my best to get vim to. -" -" You can associate the extension ".pl" with the filetype "perl6" by setting -" autocmd BufNewFile,BufRead *.pl setf perl6 -" in your ~/.vimrc. But that will infringe on Perl 5, so you might want to -" put a modeline near the beginning or end of your Perl 6 files instead: -" # vim: filetype=perl6 - -" TODO: -" * Deal with s:Perl5// -" * m:s// is a match, not a substitution -" * Make these highlight as strings, not operators: -" <==> <=:=> <===> <=~> <« »> «>» «<» -" * Allow more keywords to match as function calls(leave() is export(), etc) -" * Optimization: use nextgroup instead of lookaround (:help syn-nextgroup) -" * Fix s''' substitutions being matched as package names -" * Match s/// and m/// better, so things like "$s/" won't match -" * Add more support for folding (:help syn-fold) -" * Add more syntax syncing hooks (:help syn-sync) -" * Q//: -" :to, :heredoc -" interpolate \q:s{$scalar} (though the spec isn't very clear on it) -" -" Impossible TODO?: -" * Unspace -" * Unicode bracketing characters for quoting (there are so many) -" * Various tricks depending on context. I.e. we can't know when Perl -" expects «*» to be a string or a hyperoperator. The latter is presumably -" more common, so that's what we assume. -" * Selective highlighting of Pod formatting codes with the :allow option -" * Arbitrary number, order, and negation of adverbs to Q//, q//, qq//. -" Currently only the first adverb is considered significant. Anything -" more would require an exponential amount of regexes, making this -" already slow syntax file even slower. -" -" If you want to have Pir code inside Q:PIR// strings highlighted, do: -" let perl6_embedded_pir=1 -" -" The above requires pir.vim, which you can find in Parrot's repository: -" https://svn.parrot.org/parrot/trunk/editor/ -" -" Some less than crucial things have been made optional to speed things up. -" Look at the comments near the if/else branches in this file to see exactly -" which features are affected. "perl6_extended_all" enables everything. -" -" The defaults are: -" -" unlet perl6_extended_comments -" unlet perl6_extended_q -" unlet perl6_extended_all - -" quit when a syntax file was already loaded -if exists("b:current_syntax") - finish -endif -let s:keepcpo= &cpo -set cpo&vim - -" identifiers -syn match p6Normal display "\K\%(\k\|[-']\K\@=\)*" - -" This is used in the for loops below -" Don't use the "syn keyword" construct because that always has higher -" priority than matches/regions, so the words can't be autoquoted with -" the "=>" and "p5=>" operators. All the lookaround stuff is to make sure -" we don't match them as part of some other identifier. -let s:before_keyword = " display \"\\%(\\k\\|\\K\\@<=[-']\\)\\@.;\\]" -syn match p6Operator display "\%(:\@\)" -" "i" requires a digit to the left, and no keyword char to the right -syn match p6Operator display "\d\@<=i\k\@!" -" index overloading -syn match p6Operator display "\%(&\.(\@=\|@\.\[\@=\|%\.{\@=\)" - -" all infix operators except nonassocative ones -let s:infix_a = [ - \ "div % mod +& +< +> \\~& ?& \\~< \\~> +| +\\^ \\~| \\~\\^ ?| ?\\^ xx x", - \ "\\~ && & also <== ==> <<== ==>> == != < <= > >= \\~\\~ eq ne lt le gt", - \ "ge =:= === eqv before after \\^\\^ min max \\^ff ff\\^ \\^ff\\^", - \ "\\^fff fff\\^ \\^fff\\^ fff ff ::= := \\.= => , : p5=> Z minmax", - \ "\\.\\.\\. and andthen or orelse xor \\^ += -= /= \\*= \\~= //= ||=", - \ "+ - \\*\\* \\* // / \\~ || |", -\ ] -" nonassociative infix operators -let s:infix_n = "but does <=> leg cmp \\.\\. \\.\\.\\^\\^ \\^\\.\\. \\^\\.\\.\\^" - -let s:infix_a_long = join(s:infix_a, " ") -let s:infix_a_words = split(s:infix_a_long) -let s:infix_a_pattern = join(s:infix_a_words, "\\|") - -let s:infix_n_words = split(s:infix_n) -let s:infix_n_pattern = join(s:infix_n_words, "\\|") - -let s:both = [s:infix_a_pattern, s:infix_n_pattern] -let s:infix = join(s:both, "\\|") - -let s:infix_assoc = "!\\?\\%(" . s:infix_a_pattern . "\\)" -let s:infix = "!\\?\\%(" . s:infix . "\\)" - -unlet s:infix_a s:infix_a_long s:infix_a_words s:infix_a_pattern -unlet s:infix_n s:infix_n_pattern s:both - -" [+] reduce -exec "syn match p6ReduceOp display \"\\k\\@" - -" does is a type constraint sometimes -syn match p6TypeConstraint display "does\%(\s*\%(\k\|[-']\K\@=\)\)\@=" - -" int is a type sometimes -syn match p6Type display "\\%(\s*(\|\s\+\d\)\@!" - -" these Routine names are also Properties, if preceded by "is" -syn match p6Property display "\%(is\s\+\)\@<=\%(signature\|context\|also\|shape\)" - -" The sigil in ::*Package -syn match p6PackageTwigil display "\%(::\)\@<=\*" - -" $ -syn region p6MatchVarSigil - \ matchgroup=p6Variable - \ start="\$\%(<<\@!\)\@=" - \ end=">\@<=" - \ contains=p6MatchVar - -syn region p6MatchVar - \ matchgroup=p6Twigil - \ start="<" - \ end=">" - \ contained - -" Contextualizers -syn match p6Context display "\<\%(item\|list\|slice\|hash\)\>" -syn match p6Context display "\%(\$\|@\|%\|&\|@@\)(\@=" - -" the "$" placeholder in "$var1, $, var2 = @list" -syn match p6Placeholder display "\%(,\s*\)\@<=\$\%(\K\|\%([.^*?=!~]\|:\@]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" - \ start="\ze\z(\$\%(\%(\%(\%([.^*?=!~]\|:\@]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" - \ end="\z1\zs" - \ contained - \ contains=TOP - \ keepend - -syn region p6InterpArray - \ matchgroup=p6Context - \ start="@\ze()\@!" - \ start="@@\ze()\@!" - \ skip="([^)]*)" - \ end=")\zs" - \ contained - \ contains=TOP - -syn region p6InterpHash - \ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" - \ end="\z1\zs" - \ contained - \ contains=TOP - \ keepend - -syn region p6InterpHash - \ matchgroup=p6Context - \ start="%\ze()\@!" - \ skip="([^)]*)" - \ end=")\zs" - \ contained - \ contains=TOP - -syn region p6InterpFunction - \ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" - \ end="\z1\zs" - \ contained - \ contains=TOP - \ keepend - -syn region p6InterpFunction - \ matchgroup=p6Context - \ start="&\ze()\@!" - \ skip="([^)]*)" - \ end=")\zs" - \ contained - \ contains=TOP - -syn region p6InterpClosure - \ start="\\\@" contained -syn match p6EscCloseFrench display "\\»" contained -syn match p6EscBackTick display "\\`" contained -syn match p6EscForwardSlash display "\\/" contained -syn match p6EscVerticalBar display "\\|" contained -syn match p6EscExclamation display "\\!" contained -syn match p6EscComma display "\\," contained -syn match p6EscDollar display "\\\$" contained -syn match p6EscCloseCurly display "\\}" contained -syn match p6EscCloseBracket display "\\\]" contained - -" misc escapes -syn match p6EscOctOld display "\\\d\{1,3}" contained -syn match p6EscNull display "\\0\d\@!" contained -syn match p6EscCodePoint display "\%(\\c\)\@<=\%(\d\|\S\|\[\)\@=" contained nextgroup=p6CodePoint -syn match p6EscHex display "\%(\\x\)\@<=\%(\x\|\[\)\@=" contained nextgroup=p6HexSequence -syn match p6EscOct display "\%(\\o\)\@<=\%(\o\|\[\)\@=" contained nextgroup=p6OctSequence -syn match p6EscQQ display "\\qq" contained nextgroup=p6QQSequence -syn match p6EscOpenCurly display "\\{" contained -syn match p6EscHash display "\\#" contained -syn match p6EscBackSlash display "\\\\" contained - -syn region p6QQSequence - \ matchgroup=p6Escape - \ start="\[" - \ skip="\[[^\]]*]" - \ end="]" - \ contained - \ transparent - \ contains=@p6Interp_qq - -syn match p6CodePoint display "\%(\d\+\|\S\)" contained -syn region p6CodePoint - \ matchgroup=p6Escape - \ start="\[" - \ end="]" - \ contained - -syn match p6HexSequence display "\x\+" contained -syn region p6HexSequence - \ matchgroup=p6Escape - \ start="\[" - \ end="]" - \ contained - -syn match p6OctSequence display "\o\+" contained -syn region p6OctSequence - \ matchgroup=p6Escape - \ start="\[" - \ end="]" - \ contained - -" matches :key, :!key, :$var, :key, etc -" Since we don't know in advance how the adverb ends, we use a trick. -" Consume nothing with the start pattern (\ze at the beginning), -" while capturing the whole adverb into \z1 and then putting it before -" the match start (\zs) of the end pattern. -syn region p6Adverb - \ start="\ze\z(:!\?\K\%(\k\|[-']\K\@=\)*\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)" - \ start="\ze\z(:!\?[@$%]\$*\%(::\|\%(\$\@<=\d\+\|!\|/\|¢\)\|\%(\%([.^*?=!~]\|:\@ -" FIXME: not sure how to distinguish this from the "less than" operator -" in all cases. For now, it matches if any of the following is true: -" -" * There is whitespace missing on either side of the "<", since -" people tend to put spaces around "less than" -" * It comes after "enum", "for", "any", "all", or "none" -" * It's the first or last thing on a line (ignoring whitespace) -" * It's preceded by "= " -" -" It never matches when: -" -" * Preceded by [<+~=] (e.g. <>, =<$foo>) -" * Followed by [-=] (e.g. <--, <=, <==) -syn region p6StringAngle - \ matchgroup=p6Quote - \ start="\%(\<\%(enum\|for\|any\|all\|none\)\>\s*(\?\s*\)\@<=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!" - \ start="\%(\s\|[<+~=]\)\@\|[-=]\{1,2}>\@!\)\@!" - \ start="[<+~=]\@\|[-=]\{1,2}>\@!\)\@!" - \ start="\%(^\s*\)\@<=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!" - \ start="[<+~=]\@\|[-=]\{1,2}>\@!\)\@!" - \ skip="\\\@" - \ end=">" - \ contains=p6InnerAnglesOne,p6EscBackSlash,p6EscCloseAngle - -syn region p6InnerAnglesOne - \ matchgroup=p6StringAngle - \ start="<" - \ skip="\\\@" - \ end=">" - \ transparent - \ contained - \ contains=p6InnerAnglesOne - -" <> -syn region p6StringAngles - \ matchgroup=p6Quote - \ start="<<=\@!" - \ skip="\\\@" - \ end=">>" - \ contains=p6InnerAnglesTwo,@p6Interp_qq,p6Comment,p6EscHash,p6EscCloseAngle,p6Adverb,p6StringSQ,p6StringDQ - -syn region p6InnerAnglesTwo - \ matchgroup=p6StringAngles - \ start="<<" - \ skip="\\\@" - \ end=">>" - \ transparent - \ contained - \ contains=p6InnerAnglesTwo - -" «words» -syn region p6StringFrench - \ matchgroup=p6Quote - \ start="«" - \ skip="\\\@" nextgroup=p6QPairs skipwhite skipempty -syn match p6QPairs contained transparent skipwhite skipempty nextgroup=p6StringQ,p6StringQ_PIR "\%(\_s*:!\?\K\%(\k\|[-']\K\@=\)*\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)*" - -if exists("perl6_embedded_pir") - syn include @p6PIR syntax/pir.vim -endif - -" hardcoded set of delimiters -let s:delims = [ - \ ["\\\"", "\\\"", "p6EscDoubleQuote", "\\\\\\@", "p6EscCloseAngle", "\\%(\\\\\\@\\|<[^>]*>\\)"], - \ ["«", "»", "p6EscCloseFrench", "\\%(\\\\\\@>", "p6EscCloseAngle", "\\%(\\\\\\@>\\|<<\\%([^>]\\|>>\\@!\\)*>>\\)"]) - call add(s:delims, ["\\s\\@<=<<<", ">>>", "p6EscCloseAngle", "\\%(\\\\\\@>>\\|<<<\\%([^>]\\|>\\%(>>\\)\\@!\\)*>>>\\)"]) -endif - -if !exists("perl6_extended_q") && !exists("perl6_extended_all") - " simple version, no special highlighting within the string - for [start_delim, end_delim, end_group, skip] in s:delims - exec "syn region p6StringQ matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=".end_group." contained" - endfor - - if exists("perl6_embedded_pir") - " highlight embedded PIR code - for [start_delim, end_delim, end_group, skip] in s:delims - exec "syn region p6StringQ_PIR matchgroup=p6Quote start=\"\\%(Q\\s*:PIR\\s*\\)\\@<=".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6PIR,".end_group." contained" - endfor - endif -else - let s:before = "syn region p6StringQ matchgroup=p6Quote start=\"\\%(" - let s:after = "\\%(\\_s*:!\\?\\K\\%(\\k\\|[-']\\K\\@=\\)*\\%(([^)]*)\\|\\[[^\\]]*]\\|<[^>]*>\\|«[^»]*»\\|{[^}]*}\\)\\?\\)*\\_s*\\)\\@<=" - - let s:adverbs = [ - \ ["s", "scalar"], - \ ["a", "array"], - \ ["h", "hash"], - \ ["f", "function"], - \ ["c", "closure"], - \ ["b", "backslash"], - \ ["w", "words"], - \ ["ww", "quotewords"], - \ ["x", "exec"], - \ ] - - " these can't be conjoined with q and qq (e.g. as qqq and qqqq) - let s:q_adverbs = [ - \ ["q", "single"], - \ ["qq", "double"], - \ ] - - for [start_delim, end_delim, end_group, skip] in s:delims - " Q, q, and qq with any number of (ignored) adverbs - exec s:before ."Q". s:after .start_delim."\" end=\"". end_delim ."\""." contained" - exec s:before ."q". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q"." contained" - exec s:before ."qq". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq"." contained" - - for [short, long] in s:adverbs - " Qs, qs, qqs, Qa, qa, qqa, etc, with ignored adverbs - exec s:before ."Q".short. s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long." contained" - exec s:before ."q".short. s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q,@p6Interp_".long." contained" - exec s:before ."qq".short. s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq,@p6Interp_".long." contained" - - " Q, q, and qq, with one significant adverb - exec s:before ."Q\\s*:\\%(".short."\\|".long."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long." contained" - for [q_short, q_long] in s:q_adverbs - exec s:before ."Q\\s*:\\%(".q_short."\\|".q_long."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".q_long." contained" - endfor - exec s:before ."q\\s*:\\%(".short."\\|".long."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q,@p6Interp_".long." contained" - exec s:before ."qq\\s*:\\%(".short."\\|".long."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq,@p6Interp_".long." contained" - - for [short2, long2] in s:adverbs - " Qs, qs, qqs, Qa, qa, qqa, etc, with one significant adverb - exec s:before ."Q".short."\\s*:\\%(".short2."\\|".long2."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long.",@p6Interp_".long2." contained" - for [q_short2, q_long2] in s:q_adverbs - exec s:before ."Q".short."\\s*:\\%(".q_short2."\\|".q_long2."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long.",@p6Interp_".q_long2." contained" - endfor - exec s:before ."q".short."\\s*:\\%(".short2."\\|".long2."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q,@p6Interp_".long.",@p6Interp_".long2." contained" - exec s:before ."qq".short."\\s*:\\%(".short2."\\|".long2."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq,@p6Interp_".long.",@p6Interp_".long2." contained" - endfor - endfor - endfor - unlet s:before s:after s:adverbs s:q_adverbs -endif -unlet s:delims - -" Match these so something else above can't. E.g. the "q" in "role q { }" -" should not be considered a string -syn match p6Normal display "\%(\<\%(role\|grammar\|slang\)\s\+\)\@<=\K\%(\k\|[-']\K\@=\)*" - -" :key -syn match p6Operator display ":\@ and p5=> autoquoting -syn match p6StringP5Auto display "\K\%(\k\|[-']\K\@=\)*\ze\s\+p5=>" -syn match p6StringAuto display "\K\%(\k\|[-']\K\@=\)*\ze\%(p5\)\@" -syn match p6StringAuto display "\K\%(\k\|[-']\K\@=\)*\ze\s\+=>" -syn match p6StringAuto display "\K\%(\k\|[-']\K\@=\)*p5\ze=>" - -" Hyperoperators. Needs to come after the quoting operators (<>, «», etc) -exec "syn match p6HyperOp display \"»" .s:infix."»\\?\"" -exec "syn match p6HyperOp display \"«\\?".s:infix."«\"" -exec "syn match p6HyperOp display \"»" .s:infix."«\"" -exec "syn match p6HyperOp display \"«" .s:infix. "»\"" - -exec "syn match p6HyperOp display \">>" .s:infix."\\%(>>\\)\\?\"" -exec "syn match p6HyperOp display \"\\%(<<\\)\\?".s:infix."<<\"" -exec "syn match p6HyperOp display \">>" .s:infix."<<\"" -exec "syn match p6HyperOp display \"<<" .s:infix.">>\"" -unlet s:infix - -" Regexes and grammars - -syn match p6RegexName display "\%(\<\%(regex\|rule\|token\)\s\+\)\@<=\K\%(\k\|[-']\K\@=\)*" nextgroup=p6RegexBlockCrap skipwhite skipempty -syn match p6RegexBlockCrap "[^{]*" nextgroup=p6RegexBlock skipwhite skipempty transparent contained - -syn region p6RegexBlock - \ matchgroup=p6Normal - \ start="{" - \ end="}" - \ contained - \ contains=@p6Regexen,@p6Variables - -" Perl 6 regex bits - -syn cluster p6Regexen - \ add=p6RxMeta - \ add=p6RxEscape - \ add=p6EscHex - \ add=p6EscOct - \ add=p6EscNull - \ add=p6RxAnchor - \ add=p6RxCapture - \ add=p6RxGroup - \ add=p6RxAlternation - \ add=p6RxAdverb - \ add=p6RxAdverbArg - \ add=p6RxStorage - \ add=p6RxAssertion - \ add=p6RxQuoteWords - \ add=p6RxClosure - \ add=p6RxStringSQ - \ add=p6RxStringDQ - \ add=p6Comment - -syn match p6RxMeta display contained ".\%(\k\|\s\)\@" - \ contained - \ contains=@p6Regexen,@p6Variables,p6RxCharClass,p6RxAssertCall -syn region p6RxAssertCall - \ matchgroup=p6Normal - \ start="\%(::\|\%(\K\%(\k\|[-']\K\@=\)*\)\)\@<=(\@=" - \ end=")\@<=" - \ contained - \ contains=TOP -syn region p6RxCharClass - \ matchgroup=p6StringSpecial2 - \ start="\%(<[-!+?]\?\)\@<=\[" - \ skip="\\]" - \ end="]" - \ contained - \ contains=p6RxRange,p6RxEscape,p6EscHex,p6EscOct,p6EscNull -syn region p6RxQuoteWords - \ matchgroup=p6StringSpecial2 - \ start="< " - \ end=">" - \ contained -syn region p6RxAdverb - \ start="\ze\z(:!\?\K\%(\k\|[-']\K\@=\)*\)" - \ end="\z1\zs" - \ contained - \ contains=TOP - \ keepend -syn region p6RxAdverbArg - \ start="\%(:!\?\K\%(\k\|[-']\K\@=\)*\)\@<=(" - \ skip="([^)]*)" - \ end=")" - \ contained - \ contains=TOP -syn region p6RxStorage - \ matchgroup=p6Operator - \ start="\%(^\s*\)\@<=:\%(my\>\|temp\>\)\@=" - \ end="$" - \ contains=TOP - \ contained - -" Perl 5 regex bits - -syn cluster p6RegexP5Base - \ add=p6RxP5Escape - \ add=p6RxP5Oct - \ add=p6RxP5Hex - \ add=p6RxP5EscMeta - \ add=p6RxP5CodePoint - \ add=p6RxP5Prop - -" normal regex stuff -syn cluster p6RegexP5 - \ add=@p6RegexP5Base - \ add=p6RxP5Quantifier - \ add=p6RxP5Meta - \ add=p6RxP5QuoteMeta - \ add=p6RxP5ParenMod - \ add=p6RxP5Verb - \ add=p6RxP5Count - \ add=p6RxP5Named - \ add=p6RxP5ReadRef - \ add=p6RxP5WriteRef - \ add=p6RxP5CharClass - \ add=p6RxP5Anchor - -" inside character classes -syn cluster p6RegexP5Class - \ add=@p6RegexP5Base - \ add=p6RxP5Posix - \ add=p6RxP5Range - -syn match p6RxP5Escape display contained "\\\S" -syn match p6RxP5CodePoint display contained "\\c\S\@=" nextgroup=p6RxP5CPId -syn match p6RxP5CPId display contained "\S" -syn match p6RxP5Oct display contained "\\\%(\o\{1,3}\)\@=" nextgroup=p6RxP5OctSeq -syn match p6RxP5OctSeq display contained "\o\{1,3}" -syn match p6RxP5Anchor display contained "[\^$]" -syn match p6RxP5Hex display contained "\\x\%({\x\+}\|\x\{1,2}\)\@=" nextgroup=p6RxP5HexSeq -syn match p6RxP5HexSeq display contained "\x\{1,2}" -syn region p6RxP5HexSeq - \ matchgroup=p6RxP5Escape - \ start="{" - \ end="}" - \ contained -syn region p6RxP5Named - \ matchgroup=p6RxP5Escape - \ start="\%(\\N\)\@<={" - \ end="}" - \ contained -syn match p6RxP5Quantifier display contained "\%([+*]\|(\@" - \ contained -syn match p6RxP5WriteRef display contained "\\g\%(\d\|{\)\@=" nextgroup=p6RxP5WriteRefId -syn match p6RxP5WriteRefId display contained "\d\+" -syn region p6RxP5WriteRefId - \ matchgroup=p6RxP5Escape - \ start="{" - \ end="}" - \ contained -syn match p6RxP5Prop display contained "\\[pP]\%(\a\|{\)\@=" nextgroup=p6RxP5PropId -syn match p6RxP5PropId display contained "\a" -syn region p6RxP5PropId - \ matchgroup=p6RxP5Escape - \ start="{" - \ end="}" - \ contained -syn match p6RxP5Meta display contained "[(|).]" -syn match p6RxP5ParenMod display contained "(\@<=?\@=" nextgroup=p6RxP5Mod,p6RxP5ModName,p6RxP5Code -syn match p6RxP5Mod display contained "?\%(<\?=\|<\?!\|[#:|]\)" -syn match p6RxP5Mod display contained "?-\?[impsx]\+" -syn match p6RxP5Mod display contained "?\%([-+]\?\d\+\|R\)" -syn match p6RxP5Mod display contained "?(DEFINE)" -syn match p6RxP5Mod display contained "?\%(&\|P[>=]\)" nextgroup=p6RxP5ModDef -syn match p6RxP5ModDef display contained "\h\w*" -syn region p6RxP5ModName - \ matchgroup=p6StringSpecial - \ start="?'" - \ end="'" - \ contained -syn region p6RxP5ModName - \ matchgroup=p6StringSpecial - \ start="?P\?<" - \ end=">" - \ contained -syn region p6RxP5Code - \ matchgroup=p6StringSpecial - \ start="??\?{" - \ end="})\@=" - \ contained - \ contains=TOP -syn match p6RxP5EscMeta display contained "\\[?*.{}()[\]|\^$]" -syn match p6RxP5Count display contained "\%({\d\+\%(,\%(\d\+\)\?\)\?}\)\@=" nextgroup=p6RxP5CountId -syn region p6RxP5CountId - \ matchgroup=p6RxP5Escape - \ start="{" - \ end="}" - \ contained -syn match p6RxP5Verb display contained "(\@<=\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\?\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\?\|ACCEPT\)" -syn region p6RxP5QuoteMeta - \ matchgroup=p6RxP5Escape - \ start="\\Q" - \ end="\\E" - \ contained - \ contains=@p6Variables,p6EscBackSlash -syn region p6RxP5CharClass - \ matchgroup=p6StringSpecial - \ start="\[\^\?" - \ skip="\\]" - \ end="]" - \ contained - \ contains=@p6RegexP5Class -syn region p6RxP5Posix - \ matchgroup=p6RxP5Escape - \ start="\[:" - \ end=":]" - \ contained -syn match p6RxP5Range display contained "-" - -" 'string' inside a regex -syn region p6RxStringSQ - \ matchgroup=p6Quote - \ start="'" - \ skip="\\\@, mm, rx -syn region p6Match - \ matchgroup=p6Quote - \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@\@!>\@!" - \ skip="\\>" - \ end=">" - \ contains=@p6Regexen,@p6Variables - -" m«foo», mm«foo», rx«foo» -syn region p6Match - \ matchgroup=p6Quote - \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@ -syn region p6Match - \ matchgroup=p6Quote - \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@\@!" - \ skip="\\>" - \ end=">" - \ contains=@p6Regexen,@p6Variables - -" s«foo» -syn region p6Match - \ matchgroup=p6Quote - \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@ -syn region p6Match - \ matchgroup=p6Quote - \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@\@!" - \ skip="\\>" - \ end=">" - \ contains=@p6RegexP5,p6Variables - -" m:P5«» -syn region p6Match - \ matchgroup=p6Quote - \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@]*>" - \ end=">" - \ matchgroup=p6Error - \ start="^#<" - \ contains=p6Attention,p6Comment -syn region p6Comment - \ matchgroup=p6Comment - \ start="^\@]\|>>\@!\)*>>" - \ end=">>" - \ matchgroup=p6Error - \ start="^#<<" - \ contains=p6Attention,p6Comment - syn region p6Comment - \ matchgroup=p6Comment - \ start="^\@]\|>\%(>>\)\@!\)*>>>" - \ end=">>>" - \ matchgroup=p6Error - \ start="^#<<<" - \ contains=p6Attention,p6Comment - - syn region p6Comment - \ matchgroup=p6Comment - \ start="^\@" - \ end="^\ze\%(\s*$\|=\K\)" - \ contains=p6PodAbbrCodeType - \ keepend - -syn region p6PodAbbrCodeType - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="^\ze\%(\s*$\|=\K\)" - \ contained - \ contains=p6PodName,p6PodAbbrCode - -syn region p6PodAbbrCode - \ start="^" - \ end="^\ze\%(\s*$\|=\K\)" - \ contained - -" Abbreviated blocks (everything is a comment) -syn region p6PodAbbrRegion - \ matchgroup=p6PodPrefix - \ start="^=\zecomment\>" - \ end="^\ze\%(\s*$\|=\K\)" - \ contains=p6PodAbbrCommentType - \ keepend - -syn region p6PodAbbrCommentType - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="^\ze\%(\s*$\|=\K\)" - \ contained - \ contains=p6PodComment,p6PodAbbrNoCode - -" Abbreviated blocks (implicit code allowed) -syn region p6PodAbbrRegion - \ matchgroup=p6PodPrefix - \ start="^=\ze\%(pod\|item\|nested\|\u\+\)\>" - \ end="^\ze\%(\s*$\|=\K\)" - \ contains=p6PodAbbrType - \ keepend - -syn region p6PodAbbrType - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="^\ze\%(\s*$\|=\K\)" - \ contained - \ contains=p6PodName,p6PodAbbr - -syn region p6PodAbbr - \ start="^" - \ end="^\ze\%(\s*$\|=\K\)" - \ contained - \ contains=@p6PodFormat,p6PodImplicitCode - -" Abbreviated block to end-of-file -syn region p6PodAbbrRegion - \ matchgroup=p6PodPrefix - \ start="^=\zeEND\>" - \ end="\%$" - \ contains=p6PodAbbrEOFType - \ keepend - -syn region p6PodAbbrEOFType - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="\%$" - \ contained - \ contains=p6PodName,p6PodAbbrEOF - -syn region p6PodAbbrEOF - \ start="^" - \ end="\%$" - \ contained - \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode - -" Directives -syn region p6PodDirectRegion - \ matchgroup=p6PodPrefix - \ start="^=\%(config\|use\)\>" - \ end="^\ze\%([^=]\|=\K\|\s*$\)" - \ contains=p6PodDirectArgRegion - \ keepend - -syn region p6PodDirectArgRegion - \ matchgroup=p6PodType - \ start="\S\+" - \ end="^\ze\%([^=]\|=\K\|\s*$\)" - \ contained - \ contains=p6PodDirectConfigRegion - -syn region p6PodDirectConfigRegion - \ start="" - \ end="^\ze\%([^=]\|=\K\|\s*$\)" - \ contained - \ contains=@p6PodConfig - -" =encoding is a special directive -syn region p6PodDirectRegion - \ matchgroup=p6PodPrefix - \ start="^=encoding\>" - \ end="^\ze\%([^=]\|=\K\|\s*$\)" - \ contains=p6PodEncodingArgRegion - \ keepend - -syn region p6PodEncodingArgRegion - \ matchgroup=p6PodName - \ start="\S\+" - \ end="^\ze\%([^=]\|=\K\|\s*$\)" - \ contained - -" Paragraph blocks (implicit code forbidden) -syn region p6PodParaRegion - \ matchgroup=p6PodPrefix - \ start="^=for\>" - \ end="^\ze\%(\s*$\|=\K\)" - \ contains=p6PodParaNoCodeTypeRegion - \ keepend - \ extend - -syn region p6PodParaNoCodeTypeRegion - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="^\ze\%(\s*$\|=\K\)" - \ contained - \ contains=p6PodParaNoCode,p6PodParaConfigRegion - -syn region p6PodParaConfigRegion - \ start="" - \ end="^\ze\%([^=]\|=\k\@\ze\s*code\>" - \ end="^\ze\%(\s*$\|=\K\)" - \ contains=p6PodParaCodeTypeRegion - \ keepend - \ extend - -syn region p6PodParaCodeTypeRegion - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="^\ze\%(\s*$\|=\K\)" - \ contained - \ contains=p6PodParaCode,p6PodParaConfigRegion - -syn region p6PodParaCode - \ start="^[^=]" - \ end="^\ze\%(\s*$\|=\K\)" - \ contained - -" Paragraph blocks (implicit code allowed) -syn region p6PodParaRegion - \ matchgroup=p6PodPrefix - \ start="^=for\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>" - \ end="^\ze\%(\s*$\|=\K\)" - \ contains=p6PodParaTypeRegion - \ keepend - \ extend - -syn region p6PodParaTypeRegion - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="^\ze\%(\s*$\|=\K\)" - \ contained - \ contains=p6PodPara,p6PodParaConfigRegion - -syn region p6PodPara - \ start="^[^=]" - \ end="^\ze\%(\s*$\|=\K\)" - \ contained - \ contains=@p6PodFormat,p6PodImplicitCode - -" Paragraph block to end-of-file -syn region p6PodParaRegion - \ matchgroup=p6PodPrefix - \ start="^=for\>\ze\s\+END\>" - \ end="\%$" - \ contains=p6PodParaEOFTypeRegion - \ keepend - \ extend - -syn region p6PodParaEOFTypeRegion - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="\%$" - \ contained - \ contains=p6PodParaEOF,p6PodParaConfigRegion - -syn region p6PodParaEOF - \ start="^[^=]" - \ end="\%$" - \ contained - \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode - -" Delimited blocks (implicit code forbidden) -syn region p6PodDelimRegion - \ matchgroup=p6PodPrefix - \ start="^=begin\>" - \ end="^=end\>" - \ contains=p6PodDelimNoCodeTypeRegion - \ keepend - \ extend - -syn region p6PodDelimNoCodeTypeRegion - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="^\ze=end\>" - \ contained - \ contains=p6PodDelimNoCode,p6PodDelimConfigRegion - -syn region p6PodDelimConfigRegion - \ start="" - \ end="^\ze\%([^=]\|=\K\|\s*$\)" - \ contained - \ contains=@p6PodConfig - -syn region p6PodDelimNoCode - \ start="^" - \ end="^\ze=end\>" - \ contained - \ contains=@p6PodNestedBlocks,@p6PodFormat - -" Delimited blocks (everything is code) -syn region p6PodDelimRegion - \ matchgroup=p6PodPrefix - \ start="^=begin\>\ze\s*code\>" - \ end="^=end\>" - \ contains=p6PodDelimCodeTypeRegion - \ keepend - \ extend - -syn region p6PodDelimCodeTypeRegion - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="^\ze=end\>" - \ contained - \ contains=p6PodDelimCode,p6PodDelimConfigRegion - -syn region p6PodDelimCode - \ start="^" - \ end="^\ze=end\>" - \ contained - \ contains=@p6PodNestedBlocks - -" Delimited blocks (implicit code allowed) -syn region p6PodDelimRegion - \ matchgroup=p6PodPrefix - \ start="^=begin\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>" - \ end="^=end\>" - \ contains=p6PodDelimTypeRegion - \ keepend - \ extend - -syn region p6PodDelimTypeRegion - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="^\ze=end\>" - \ contained - \ contains=p6PodDelim,p6PodDelimConfigRegion - -syn region p6PodDelim - \ start="^" - \ end="^\ze=end\>" - \ contained - \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode - -" Delimited block to end-of-file -syn region p6PodDelimRegion - \ matchgroup=p6PodPrefix - \ start="^=begin\>\ze\s\+END\>" - \ end="\%$" - \ contains=p6PodDelimEOFTypeRegion - \ extend - -syn region p6PodDelimEOFTypeRegion - \ matchgroup=p6PodType - \ start="\K\k*" - \ end="\%$" - \ contained - \ contains=p6PodDelimEOF,p6PodDelimConfigRegion - -syn region p6PodDelimEOF - \ start="^" - \ end="\%$" - \ contained - \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode - -syn cluster p6PodConfig - \ add=p6PodConfigOperator - \ add=p6PodExtraConfig - \ add=p6StringAuto - \ add=p6PodAutoQuote - \ add=p6StringSQ - -syn region p6PodParens - \ start="(" - \ end=")" - \ contained - \ contains=p6Number,p6StringSQ - -syn match p6PodAutoQuote display contained "=>" -syn match p6PodConfigOperator display contained ":!\?" nextgroup=p6PodConfigOption -syn match p6PodConfigOption display contained "[^[:space:](<]\+" nextgroup=p6PodParens,p6StringAngle -syn match p6PodExtraConfig display contained "^=" -syn match p6PodVerticalBar display contained "|" -syn match p6PodColon display contained ":" -syn match p6PodSemicolon display contained ";" -syn match p6PodComma display contained "," -syn match p6PodImplicitCode display contained "^\s.*" - -syn region p6PodDelimEndRegion - \ matchgroup=p6PodType - \ start="\%(^=end\>\)\@<=" - \ end="\K\k*" - -" These may appear inside delimited blocks -syn cluster p6PodNestedBlocks - \ add=p6PodAbbrRegion - \ add=p6PodDirectRegion - \ add=p6PodParaRegion - \ add=p6PodDelimRegion - \ add=p6PodDelimEndRegion - -" Pod formatting codes - -syn cluster p6PodFormat - \ add=p6PodFormatOne - \ add=p6PodFormatTwo - \ add=p6PodFormatThree - \ add=p6PodFormatFrench - -" Balanced angles found inside formatting codes. Ensures proper nesting. - -syn region p6PodFormatAnglesOne - \ matchgroup=p6PodFormat - \ start="<" - \ skip="<[^>]*>" - \ end=">" - \ transparent - \ contained - \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne - -syn region p6PodFormatAnglesTwo - \ matchgroup=p6PodFormat - \ start="<<" - \ skip="<<[^>]*>>" - \ end=">>" - \ transparent - \ contained - \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo - -syn region p6PodFormatAnglesThree - \ matchgroup=p6PodFormat - \ start="<<<" - \ skip="<<<[^>]*>>>" - \ end=">>>" - \ transparent - \ contained - \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo,p6PodFormatAnglesThree - -syn region p6PodFormatAnglesFrench - \ matchgroup=p6PodFormat - \ start="«" - \ skip="«[^»]*»" - \ end="»" - \ transparent - \ contained - \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo,p6PodFormatAnglesThree - -" All formatting codes - -syn region p6PodFormatOne - \ matchgroup=p6PodFormatCode - \ start="\u<" - \ skip="<[^>]*>" - \ end=">" - \ contained - \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne - -syn region p6PodFormatTwo - \ matchgroup=p6PodFormatCode - \ start="\u<<" - \ skip="<<[^>]*>>" - \ end=">>" - \ contained - \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo - -syn region p6PodFormatThree - \ matchgroup=p6PodFormatCode - \ start="\u<<<" - \ skip="<<<[^>]*>>>" - \ end=">>>" - \ contained - \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree - -syn region p6PodFormatFrench - \ matchgroup=p6PodFormatCode - \ start="\u«" - \ skip="«[^»]*»" - \ end="»" - \ contained - \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree - -" C<> and V<> don't allow nested formatting formatting codes - -syn region p6PodFormatOne - \ matchgroup=p6PodFormatCode - \ start="[CV]<" - \ skip="<[^>]*>" - \ end=">" - \ contained - \ contains=p6PodFormatAnglesOne - -syn region p6PodFormatTwo - \ matchgroup=p6PodFormatCode - \ start="[CV]<<" - \ skip="<<[^>]*>>" - \ end=">>" - \ contained - \ contains=p6PodFormatAnglesTwo - -syn region p6PodFormatThree - \ matchgroup=p6PodFormatCode - \ start="[CV]<<<" - \ skip="<<<[^>]*>>>" - \ end=">>>" - \ contained - \ contains=p6PodFormatAnglesThree - -syn region p6PodFormatFrench - \ matchgroup=p6PodFormatCode - \ start="[CV]«" - \ skip="«[^»]*»" - \ end="»" - \ contained - \ contains=p6PodFormatAnglesFrench - -" L<> can have a "|" separator - -syn region p6PodFormatOne - \ matchgroup=p6PodFormatCode - \ start="L<" - \ skip="<[^>]*>" - \ end=">" - \ contained - \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar - -syn region p6PodFormatTwo - \ matchgroup=p6PodFormatCode - \ start="L<<" - \ skip="<<[^>]*>>" - \ end=">>" - \ contained - \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar - -syn region p6PodFormatThree - \ matchgroup=p6PodFormatCode - \ start="L<<<" - \ skip="<<<[^>]*>>>" - \ end=">>>" - \ contained - \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar - -syn region p6PodFormatFrench - \ matchgroup=p6PodFormatCode - \ start="L«" - \ skip="«[^»]*»" - \ end="»" - \ contained - \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar - -" E<> can have a ";" separator - -syn region p6PodFormatOne - \ matchgroup=p6PodFormatCode - \ start="E<" - \ skip="<[^>]*>" - \ end=">" - \ contained - \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodSemiColon - -syn region p6PodFormatTwo - \ matchgroup=p6PodFormatCode - \ start="E<<" - \ skip="<<[^>]*>>" - \ end=">>" - \ contained - \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodSemiColon - -syn region p6PodFormatThree - \ matchgroup=p6PodFormatCode - \ start="E<<<" - \ skip="<<<[^>]*>>>" - \ end=">>>" - \ contained - \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodSemiColon - -syn region p6PodFormatFrench - \ matchgroup=p6PodFormatCode - \ start="E«" - \ skip="«[^»]*»" - \ end="»" - \ contained - \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodSemiColon - -" M<> can have a ":" separator - -syn region p6PodFormatOne - \ matchgroup=p6PodFormatCode - \ start="M<" - \ skip="<[^>]*>" - \ end=">" - \ contained - \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodColon - -syn region p6PodFormatTwo - \ matchgroup=p6PodFormatCode - \ start="M<<" - \ skip="<<[^>]*>>" - \ end=">>" - \ contained - \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodColon - -syn region p6PodFormatThree - \ matchgroup=p6PodFormatCode - \ start="M<<<" - \ skip="<<<[^>]*>>>" - \ end=">>>" - \ contained - \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodColon - -syn region p6PodFormatFrench - \ matchgroup=p6PodFormatCode - \ start="M«" - \ skip="«[^»]*»" - \ end="»" - \ contained - \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodColon - -" D<> can have "|" and ";" separators - -syn region p6PodFormatOne - \ matchgroup=p6PodFormatCode - \ start="D<" - \ skip="<[^>]*>" - \ end=">" - \ contained - \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar,p6PodSemiColon - -syn region p6PodFormatTwo - \ matchgroup=p6PodFormatCode - \ start="D<<" - \ skip="<<[^>]*>>" - \ end=">>" - \ contained - \ contains=p6PodFormatAngleTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar,p6PodSemiColon - -syn region p6PodFormatThree - \ matchgroup=p6PodFormatCode - \ start="D<<<" - \ skip="<<<[^>]*>>>" - \ end=">>>" - \ contained - \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon - -syn region p6PodFormatFrench - \ matchgroup=p6PodFormatCode - \ start="D«" - \ skip="«[^»]*»" - \ end="»" - \ contained - \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon - -" X<> can have "|", "," and ";" separators - -syn region p6PodFormatOne - \ matchgroup=p6PodFormatCode - \ start="X<" - \ skip="<[^>]*>" - \ end=">" - \ contained - \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar,p6PodSemiColon,p6PodComma - -syn region p6PodFormatTwo - \ matchgroup=p6PodFormatCode - \ start="X<<" - \ skip="<<[^>]*>>" - \ end=">>" - \ contained - \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar,p6PodSemiColon,p6PodComma - -syn region p6PodFormatThree - \ matchgroup=p6PodFormatCode - \ start="X<<<" - \ skip="<<<[^>]*>>>" - \ end=">>>" - \ contained - \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma - -syn region p6PodFormatFrench - \ matchgroup=p6PodFormatCode - \ start="X«" - \ skip="«[^»]*»" - \ end="»" - \ contained - \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma - -" Define the default highlighting. -" Only when an item doesn't have highlighting yet - -hi def link p6EscOctOld p6Error -hi def link p6PackageTwigil p6Twigil -hi def link p6StringAngle p6String -hi def link p6StringFrench p6String -hi def link p6StringAngles p6String -hi def link p6StringSQ p6String -hi def link p6StringDQ p6String -hi def link p6StringQ p6String -hi def link p6RxStringSQ p6String -hi def link p6RxStringDQ p6String -hi def link p6Substitution p6String -hi def link p6Transliteration p6String -hi def link p6StringAuto p6String -hi def link p6StringP5Auto p6String -hi def link p6Key p6String -hi def link p6Match p6String -hi def link p6RegexBlock p6String -hi def link p6RxP5CharClass p6String -hi def link p6RxP5QuoteMeta p6String -hi def link p6RxCharClass p6String -hi def link p6RxQuoteWords p6String -hi def link p6ReduceOp p6Operator -hi def link p6ReverseCrossOp p6Operator -hi def link p6HyperOp p6Operator -hi def link p6QuoteQ p6Operator -hi def link p6RxRange p6StringSpecial -hi def link p6RxAnchor p6StringSpecial -hi def link p6RxP5Anchor p6StringSpecial -hi def link p6CodePoint p6StringSpecial -hi def link p6RxMeta p6StringSpecial -hi def link p6RxP5Range p6StringSpecial -hi def link p6RxP5CPId p6StringSpecial -hi def link p6RxP5Posix p6StringSpecial -hi def link p6RxP5Mod p6StringSpecial -hi def link p6RxP5HexSeq p6StringSpecial -hi def link p6RxP5OctSeq p6StringSpecial -hi def link p6RxP5WriteRefId p6StringSpecial -hi def link p6HexSequence p6StringSpecial -hi def link p6OctSequence p6StringSpecial -hi def link p6RxP5Named p6StringSpecial -hi def link p6RxP5PropId p6StringSpecial -hi def link p6RxP5Quantifier p6StringSpecial -hi def link p6RxP5CountId p6StringSpecial -hi def link p6RxP5Verb p6StringSpecial -hi def link p6Escape p6StringSpecial2 -hi def link p6EscNull p6StringSpecial2 -hi def link p6EscHash p6StringSpecial2 -hi def link p6EscQQ p6StringSpecial2 -hi def link p6EscQuote p6StringSpecial2 -hi def link p6EscDoubleQuote p6StringSpecial2 -hi def link p6EscBackTick p6StringSpecial2 -hi def link p6EscForwardSlash p6StringSpecial2 -hi def link p6EscVerticalBar p6StringSpecial2 -hi def link p6EscExclamation p6StringSpecial2 -hi def link p6EscDollar p6StringSpecial2 -hi def link p6EscOpenCurly p6StringSpecial2 -hi def link p6EscCloseCurly p6StringSpecial2 -hi def link p6EscCloseBracket p6StringSpecial2 -hi def link p6EscCloseAngle p6StringSpecial2 -hi def link p6EscCloseFrench p6StringSpecial2 -hi def link p6EscBackSlash p6StringSpecial2 -hi def link p6RxEscape p6StringSpecial2 -hi def link p6RxCapture p6StringSpecial2 -hi def link p6RxAlternation p6StringSpecial2 -hi def link p6RxP5 p6StringSpecial2 -hi def link p6RxP5ReadRef p6StringSpecial2 -hi def link p6RxP5Oct p6StringSpecial2 -hi def link p6RxP5Hex p6StringSpecial2 -hi def link p6RxP5EscMeta p6StringSpecial2 -hi def link p6RxP5Meta p6StringSpecial2 -hi def link p6RxP5Escape p6StringSpecial2 -hi def link p6RxP5CodePoint p6StringSpecial2 -hi def link p6RxP5WriteRef p6StringSpecial2 -hi def link p6RxP5Prop p6StringSpecial2 - -hi def link p6Property Tag -hi def link p6Attention Todo -hi def link p6Type Type -hi def link p6Error Error -hi def link p6BlockLabel Label -hi def link p6Float Float -hi def link p6Normal Normal -hi def link p6Package Normal -hi def link p6PackageScope Normal -hi def link p6Number Number -hi def link p6VersionNum Number -hi def link p6String String -hi def link p6Repeat Repeat -hi def link p6Keyword Keyword -hi def link p6Pragma Keyword -hi def link p6Module Keyword -hi def link p6DeclareRoutine Keyword -hi def link p6VarStorage Special -hi def link p6FlowControl Special -hi def link p6NumberBase Special -hi def link p6Twigil Special -hi def link p6StringSpecial2 Special -hi def link p6VersionDot Special -hi def link p6Comment Comment -hi def link p6Include Include -hi def link p6Shebang PreProc -hi def link p6ClosureTrait PreProc -hi def link p6Routine Function -hi def link p6Operator Operator -hi def link p6Version Operator -hi def link p6Context Operator -hi def link p6Quote Delimiter -hi def link p6TypeConstraint PreCondit -hi def link p6Exception Exception -hi def link p6Placeholder Identifier -hi def link p6Variable Identifier -hi def link p6VarSlash Identifier -hi def link p6VarNum Identifier -hi def link p6VarExclam Identifier -hi def link p6VarMatch Identifier -hi def link p6VarName Identifier -hi def link p6MatchVar Identifier -hi def link p6RxP5ReadRefId Identifier -hi def link p6RxP5ModDef Identifier -hi def link p6RxP5ModName Identifier -hi def link p6Conditional Conditional -hi def link p6StringSpecial SpecialChar - -hi def link p6PodAbbr p6Pod -hi def link p6PodAbbrEOF p6Pod -hi def link p6PodAbbrNoCode p6Pod -hi def link p6PodAbbrCode p6PodCode -hi def link p6PodPara p6Pod -hi def link p6PodParaEOF p6Pod -hi def link p6PodParaNoCode p6Pod -hi def link p6PodParaCode p6PodCode -hi def link p6PodDelim p6Pod -hi def link p6PodDelimEOF p6Pod -hi def link p6PodDelimNoCode p6Pod -hi def link p6PodDelimCode p6PodCode -hi def link p6PodImplicitCode p6PodCode -hi def link p6PodExtraConfig p6PodPrefix -hi def link p6PodVerticalBar p6PodFormatCode -hi def link p6PodColon p6PodFormatCode -hi def link p6PodSemicolon p6PodFormatCode -hi def link p6PodComma p6PodFormatCode -hi def link p6PodFormatOne p6PodFormat -hi def link p6PodFormatTwo p6PodFormat -hi def link p6PodFormatThree p6PodFormat -hi def link p6PodFormatFrench p6PodFormat - -hi def link p6PodType Type -hi def link p6PodConfigOption String -hi def link p6PodCode PreProc -hi def link p6Pod Comment -hi def link p6PodComment Comment -hi def link p6PodAutoQuote Operator -hi def link p6PodConfigOperator Operator -hi def link p6PodPrefix Statement -hi def link p6PodName Identifier -hi def link p6PodFormatCode SpecialChar -hi def link p6PodFormat SpecialComment - - -" Syncing to speed up processing -"syn sync match p6SyncPod groupthere p6PodAbbrRegion "^=\K\k*\>" -"syn sync match p6SyncPod groupthere p6PodDirectRegion "^=\%(config\|use\|encoding\)\>" -"syn sync match p6SyncPod groupthere p6PodParaRegion "^=for\>" -"syn sync match p6SyncPod groupthere p6PodDelimRegion "^=begin\>" -"syn sync match p6SyncPod groupthere p6PodDelimEndRegion "^=end\>" - -" Let's just sync whole file, the other methods aren't reliable (or I don't -" know how to use them reliably) -syn sync fromstart - -setlocal foldmethod=syntax - -let b:current_syntax = "perl6" - -let &cpo = s:keepcpo -unlet s:keepcpo - -" vim:ts=8:sts=4:sw=4:expandtab:ft=vim diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim --- a/runtime/syntax/r.vim +++ b/runtime/syntax/r.vim @@ -5,7 +5,7 @@ " Tom Payne " Contributor: Johannes Ranke " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Wed Aug 01, 2018 10:10PM +" Last Change: Sun Mar 28, 2021 01:47PM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions might be defined in @@ -53,12 +53,12 @@ syn match rCommentTodo contained "\(BUG\ syn match rTodoParen contained "\(BUG\|FIXME\|NOTE\|TODO\)\s*(.\{-})\s*:" contains=rTodoKeyw,rTodoInfo transparent syn keyword rTodoKeyw BUG FIXME NOTE TODO contained syn match rTodoInfo "(\zs.\{-}\ze)" contained -syn match rComment contains=@Spell,rCommentTodo,rTodoParen,rOBlock "#.*" +syn match rComment contains=@Spell,rCommentTodo,rTodoParen "#.*" " Roxygen if g:r_syntax_hl_roxygen " A roxygen block can start at the beginning of a file (first version) and - " after a blank line (second version). It ends when a line that does not + " after a blank line (second version). It ends when a line appears that does not " contain a roxygen comment. In the following comments, any line containing " a roxygen comment marker (one or two hash signs # followed by a single " quote ' and preceded only by whitespace) is called a roxygen line. A @@ -71,6 +71,12 @@ if g:r_syntax_hl_roxygen syn match rOTitleBlock "\%^\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag syn match rOTitleBlock "^\s*\n\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag + " A title as part of a block is always at the beginning of the block, i.e. + " either at the start of a file or after a completely empty line. + syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag + syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag + syn match rOTitleTag contained "@title" + " When a roxygen block has a title and additional content, the title " consists of one or more roxygen lines (as little as possible are matched), " followed either by an empty roxygen line @@ -87,16 +93,15 @@ if g:r_syntax_hl_roxygen syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold - " A title as part of a block is always at the beginning of the block, i.e. - " either at the start of a file or after a completely empty line. - syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag - syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag - syn match rOTitleTag contained "@title" + syn match rOCommentKey "^\s*#\{1,2}'" contained + syn region rOExamples start="^\s*#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold - syn match rOCommentKey "^\s*#\{1,2}'" contained - syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold + " R6 classes may contain roxygen lines independent of roxygen blocks + syn region rOR6Class start=/R6Class(/ end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError fold + syn match rOR6Block "#\{1,2}'.*" contains=rOTag,rOExamples,@Spell containedin=rOR6Class contained + syn match rOR6Block "^\s*#\{1,2}'.*" contains=rOTag,rOExamples,@Spell containedin=rOR6Class contained - " rOTag list generated from the lists in + " rOTag list originally generated from the lists that were available in " https://github.com/klutometis/roxygen/R/rd.R and " https://github.com/klutometis/roxygen/R/namespace.R " using s/^ \([A-Za-z0-9]*\) = .*/ syn match rOTag contained "@\1"/ @@ -155,7 +160,10 @@ if g:r_syntax_hl_roxygen syn match rOTag contained "@S3method" syn match rOTag contained "@useDynLib" " other + syn match rOTag contained "@eval" syn match rOTag contained "@include" + syn match rOTag contained "@includeRmd" + syn match rOTag contained "@order" endif @@ -186,6 +194,11 @@ syn match rSpecial display contained "\\ syn match rSpecial display contained "\\u{\x\{1,4}}" syn match rSpecial display contained "\\U{\x\{1,8}}" +" Raw string +syn region rRawString matchgroup=rRawStrDelim start=/[rR]\z(['"]\)\z(-*\)(/ end=/)\z2\z1/ keepend +syn region rRawString matchgroup=rRawStrDelim start=/[rR]\z(['"]\)\z(-*\){/ end=/}\z2\z1/ keepend +syn region rRawString matchgroup=rRawStrDelim start=/[rR]\z(['"]\)\z(-*\)\[/ end=/\]\z2\z1/ keepend + " Statement syn keyword rStatement break next return syn keyword rConditional if else @@ -354,6 +367,8 @@ hi def link rOperator Operator hi def link rOpError Error hi def link rParenError Error hi def link rPreProc PreProc +hi def link rRawString String +hi def link rRawStrDelim Delimiter hi def link rRepeat Repeat hi def link rSpecial SpecialChar hi def link rStatement Statement @@ -366,6 +381,7 @@ if g:r_syntax_hl_roxygen hi def link rOTitleBlock Title hi def link rOBlock Comment hi def link rOBlockNoTitle Comment + hi def link rOR6Block Comment hi def link rOTitle Title hi def link rOCommentKey Comment hi def link rOExamples SpecialComment diff --git a/runtime/syntax/raku.vim b/runtime/syntax/raku.vim new file mode 100644 --- /dev/null +++ b/runtime/syntax/raku.vim @@ -0,0 +1,1971 @@ +" Vim syntax file +" Language: Raku +" Maintainer: vim-perl +" Homepage: https://github.com/Raku/vim-raku +" Bugs/requests: https://github.com/Raku/vim-raku/issues +" Last Change: 2021-04-16 + +" Contributors: Luke Palmer +" Moritz Lenz +" Hinrik Örn Sigurðsson +" +" This is a big undertaking. +" +" The ftdetect/raku.vim file in this repository takes care of setting the +" right filetype for Raku files. To set it explicitly you can also add this +" line near the bottom of your source file: +" # vim: filetype=raku + +" TODO: +" * Go over the list of keywords/types to see what's deprecated/missing +" * Add more support for folding (:help syn-fold) +" +" If you want to have Pir code inside Q:PIR// strings highlighted, do: +" let raku_embedded_pir=1 +" +" The above requires pir.vim, which you can find in Parrot's repository: +" https://github.com/parrot/parrot/tree/master/editor +" +" To highlight Perl 5 regexes (m:P5//): +" let raku_perl5_regexes=1 +" +" To enable folding: +" let raku_fold=1 + +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 + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif +let s:keepcpo= &cpo +set cpo&vim + +" Patterns which will be interpolated by the preprocessor (tools/preproc.pl): +" +" @@IDENT_NONDIGIT@@ "[A-Za-z_\xC0-\xFF]" +" @@IDENT_CHAR@@ "[A-Za-z_\xC0-\xFF0-9]" +" @@IDENTIFIER@@ "\%(@@IDENT_NONDIGIT@@\%(@@IDENT_CHAR@@\|[-']@@IDENT_NONDIGIT@@\@=\)*\)" +" @@IDENTIFIER_START@@ "@@IDENT_CHAR@@\@1". +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 +syn match rakuDeclare display "[.^]\@1" nextgroup=rakuIdentifier skipwhite skipempty +syn match rakuDeclareRegex display "[.^]\@1" nextgroup=rakuRegexName skipwhite skipempty + +syn match rakuTypeConstraint display "\%([.^]\|^\s*\)\@" +syn match rakuTypeConstraint display "\%([.^]\|^\s*\)\@».;\\∈∉∋∌∩∪≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖∅∘]" +syn match rakuOperator display "\%(:\@1][=+]\?\|cont\|elem\))" + +" Reverse, cross, and zip metaoperators +exec "syn match rakuRSXZOp display \"[RSXZ]:\\@!\\%(\\a\\@=\\%(". s:alpha_metaops_or . "\\)\\>\\|[[:alnum:]]\\@!\\%([.,]\\|[^[,.[:alnum:][:space:]]\\)\\+\\|\\s\\@=\\|$\\)\"" + +syn match rakuBlockLabel display "^\s*\zs\h\w*\s*::\@!\_s\@=" + +syn match rakuNumber display "[A-Za-z_\xC0-\xFF0-9]\@1" +syn match rakuContext display "\%(\$\|@\|%\|&\)(\@=" + +" Quoting + +" one cluster for every quote adverb +syn cluster rakuInterp_scalar + \ add=rakuInterpScalar + +syn cluster rakuInterp_array + \ add=rakuInterpArray + +syn cluster rakuInterp_hash + \ add=rakuInterpHash + +syn cluster rakuInterp_function + \ add=rakuInterpFunction + +syn cluster rakuInterp_closure + \ add=rakuInterpClosure + +syn cluster rakuInterp_q + \ add=rakuEscQQ + \ add=rakuEscBackSlash + +syn cluster rakuInterp_backslash + \ add=@rakuInterp_q + \ add=rakuEscape + \ add=rakuEscOpenCurly + \ add=rakuEscCodePoint + \ add=rakuEscHex + \ add=rakuEscOct + \ add=rakuEscOctOld + \ add=rakuEscNull + +syn cluster rakuInterp_qq + \ add=@rakuInterp_scalar + \ add=@rakuInterp_array + \ add=@rakuInterp_hash + \ add=@rakuInterp_function + \ add=@rakuInterp_closure + \ add=@rakuInterp_backslash + \ add=rakuMatchVarSigil + +syn region rakuInterpScalar + \ start="\ze\z(\$\%(\%(\%(\d\+\|!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" + \ start="\ze\z(\$\%(\%(\%(\%([.^*?=!~]\|:\@1]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" + \ end="\z1\zs" + \ contained keepend + \ contains=TOP + +syn region rakuInterpArray + \ matchgroup=rakuContext + \ start="@\ze()\@!" + \ skip="([^)]*)" + \ end=")\zs" + \ contained + \ contains=TOP + +syn region rakuInterpHash + \ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" + \ end="\z1\zs" + \ contained keepend + \ contains=TOP + +syn region rakuInterpHash + \ matchgroup=rakuContext + \ start="%\ze()\@!" + \ skip="([^)]*)" + \ end=")\zs" + \ contained + \ contains=TOP + +syn region rakuInterpFunction + \ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" + \ end="\z1\zs" + \ contained keepend + \ contains=TOP + +syn region rakuInterpFunction + \ matchgroup=rakuContext + \ start="&\ze()\@!" + \ skip="([^)]*)" + \ end=")\zs" + \ contained + \ contains=TOP + +syn region rakuInterpClosure + \ start="\\\@1" contained +syn match rakuEscCloseFrench display "\\»" contained +syn match rakuEscBackTick display "\\`" contained +syn match rakuEscForwardSlash display "\\/" contained +syn match rakuEscVerticalBar display "\\|" contained +syn match rakuEscExclamation display "\\!" contained +syn match rakuEscComma display "\\," contained +syn match rakuEscDollar display "\\\$" contained +syn match rakuEscCloseCurly display "\\}" contained +syn match rakuEscCloseBracket display "\\\]" contained + +" matches :key, :!key, :$var, :key, etc +" Since we don't know in advance how the adverb ends, we use a trick. +" Consume nothing with the start pattern (\ze at the beginning), +" while capturing the whole adverb into \z1 and then putting it before +" the match start (\zs) of the end pattern. +syn region rakuAdverb + \ start="\ze\z(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)" + \ start="\ze\z(:!\?[@$%]\$*\%(::\|\%(\$\@1<=\d\+\|!\|/\|¢\)\|\%(\%([.^*?=!~]\|:\@1 +" Distinguishing this from the "less than" operator is tricky. For now, +" it matches if any of the following is true: +" +" * There is whitespace missing on either side of the "<", since +" people tend to put spaces around "less than". We make an exception +" for " = < ... >" assignments though. +" * It comes after "enum", "for", "any", "all", or "none" +" * It's the first or last thing on a line (ignoring whitespace) +" * It's preceded by "(\s*" or "=\s\+" +" * It's empty and terminated on the same line (e.g. <> and < >) +" +" It never matches when: +" +" * Preceded by [<+~=!] (e.g. <>, =<$foo>, * !< 3) +" * Followed by [-=] (e.g. <--, <=, <==, <->) +syn region rakuStringAngle + \ matchgroup=rakuQuote + \ start="\%(\<\%(enum\|for\|any\|all\|none\)\>\s*(\?\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" + \ start="\%(\s\|[<+~=!]\)\@\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" + \ start="[<+~=!]\@1\|\%([=-]\{1,2}>\|[=-]\{1,2}\)\)\@!" + \ start="\%(^\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" + \ start="[<+~=!]\@1\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" + \ start="<\%(\s*>\)\@=" + \ skip="\\\@1" + \ end=">" + \ contains=rakuInnerAnglesOne,rakuEscBackSlash,rakuEscCloseAngle + +syn region rakuStringAngleFixed + \ matchgroup=rakuQuote + \ start="<" + \ skip="\\\@1" + \ end=">" + \ contains=rakuInnerAnglesOne,rakuEscBackSlash,rakuEscCloseAngle + \ contained + +syn region rakuInnerAnglesOne + \ matchgroup=rakuStringAngle + \ start="\\\@1" + \ end=">" + \ transparent contained + \ contains=rakuInnerAnglesOne + +" <> +syn region rakuStringAngles + \ matchgroup=rakuQuote + \ start="<<=\@!" + \ skip="\\\@1" + \ end=">>" + \ contains=rakuInnerAnglesTwo,@rakuInterp_qq,rakuComment,rakuBracketComment,rakuEscHash,rakuEscCloseAngle,rakuAdverb,rakuStringSQ,rakuStringDQ + +syn region rakuInnerAnglesTwo + \ matchgroup=rakuStringAngles + \ start="<<" + \ skip="\\\@1" + \ end=">>" + \ transparent contained + \ contains=rakuInnerAnglesTwo + +" «words» +syn region rakuStringFrench + \ matchgroup=rakuQuote + \ start="«" + \ skip="\\\@1" and "«»" strings in order to override +" them, but before other types of strings, to avoid matching those delimiters +" as parts of hyperops. +syn match rakuHyperOp display #[^[:digit:][{('",:[:space:]][^[{('",:[:space:]]*\%(«\|<<\)# +syn match rakuHyperOp display "«\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+[«»]" +syn match rakuHyperOp display "»\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(«\|»\?\)" +syn match rakuHyperOp display "<<\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(<<\|>>\)" +syn match rakuHyperOp display ">>\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(<<\|\%(>>\)\?\)" + +" 'string' +syn region rakuStringSQ + \ matchgroup=rakuQuote + \ start="'" + \ skip="\\\@1", "rakuEscCloseAngle", "\\%(\\\\\\@1\\|<[^>]*>\\)"], + \ ["French", "«", "»", "rakuEscCloseFrench", "\\%(\\\\\\@1, @ +syn region rakuMatchVarSigil + \ matchgroup=rakuVariable + \ start="[$@]\%(<<\@!\)\@=" + \ end=">\@1<=" + \ contains=rakuMatchVar + +syn region rakuMatchVar + \ matchgroup=rakuTwigil + \ start="<" + \ end=">" + \ contained + +syn region rakuRxClosure + \ matchgroup=rakuNormal + \ start="{" + \ end="}" + \ contained + \ containedin=rakuRxClosure + \ contains=TOP +syn region rakuRxGroup + \ matchgroup=rakuStringSpecial2 + \ start="\[" + \ end="]" + \ contained + \ contains=@rakuRegexen,@rakuVariables,rakuMatchVarSigil +syn region rakuRxAssertion + \ matchgroup=rakuStringSpecial2 + \ start="<\%(?\?\%(before\|after\)\|\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)=\)\|[+?*]\)\?" + \ end=">" + \ contained + \ contains=@rakuRegexen,rakuIdentifier,@rakuVariables,rakuRxCharClass,rakuRxAssertCall +syn region rakuRxAssertGroup + \ matchgroup=rakuStringSpecial2 + \ start="<\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)=\[" + \ skip="\\\@1" + \ contained keepend + \ contains=TOP +syn match rakuRxBoundary display contained "\%([«»]\|<<\|>>\)" +syn region rakuRxCharClass + \ matchgroup=rakuStringSpecial2 + \ start="\%(<[-!+?]\?\)\@2<=\[" + \ skip="\\]" + \ end="]" + \ contained + \ contains=rakuRxRange,rakuRxEscape,rakuEscHex,rakuEscOct,rakuEscCodePoint,rakuEscNull +syn region rakuRxQuoteWords + \ matchgroup=rakuStringSpecial2 + \ start="<\s" + \ end="\s\?>" + \ contained +syn region rakuRxAdverb + \ start="\ze\z(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)" + \ end="\z1\zs" + \ contained keepend + \ contains=TOP +syn region rakuRxAdverbArg + \ start="\%(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\@<=(" + \ skip="([^)]\{-})" + \ end=")" + \ contained + \ keepend + \ contains=TOP +syn region rakuRxStorage + \ matchgroup=rakuOperator + \ start="\%(^\s*\)\@<=:\%(my\>\|temp\>\)\@=" + \ end="$" + \ contains=TOP + \ contained + \ keepend + +" 'string' inside a regex +syn region rakuRxStringSQ + \ matchgroup=rakuQuote + \ start="'" + \ skip="\\\@1\)\)\@=" +syn match rakuVarSlash display "\$/" +syn match rakuVarExclam display "\$!" +syn match rakuVarMatch display "\$¢" +syn match rakuVarNum display "\$\d\+" +syn match rakuVariable display "self" +syn match rakuVariable display "[@$%&]\?[@&$%]\$*\%(::\|\%(\%([.^*?=!~]\|:\@1>\)" contained +syn match rakuTwigil display "\%([.^*?=!~]\|:\@1\|\<\%(if\|unless\|while\|when\|where\|so\)\)\s*\)\@<=/[/=]\@!" + \ skip="\\/" + \ end="/" + \ contains=@rakuRegexen,rakuVariable,rakuVarExclam,rakuVarMatch,rakuVarNum + +" m/foo/, m$foo$, m!foo!, etc +syn region rakuMatch + \ matchgroup=rakuQuote + \ start=+\z([/!$,|`"]\)+ + \ skip="\\\z1" + \ end="\z1" + \ contained + \ contains=@rakuRegexen,rakuVariable,rakuVarNum + +" m, m«foo», m{foo}, etc +for [s:name, s:start_delim, s:end_delim, s:end_group, s:skip] in s:bracketing_delims + exec "syn region rakuMatch matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=@rakuRegexen,@rakuVariables" +endfor +unlet s:name s:start_delim s:end_delim s:end_group s:skip + +" Substitutions + +" s/foo//, s$foo$$, s!foo!!, etc +syn region rakuSubstitution + \ matchgroup=rakuQuote + \ start=+\z([/!$,|`"]\)+ + \ skip="\\\z1" + \ end="\z1"me=e-1 + \ contained + \ contains=@rakuRegexen,rakuVariable,rakuVarNum + \ nextgroup=rakuReplacement + +syn region rakuReplacement + \ matchgroup=rakuQuote + \ start="\z(.\)" + \ skip="\\\z1" + \ end="\z1" + \ contained + \ contains=@rakuInterp_qq + +" s, s«foo»«bar», s{foo}{bar}, etc +for [s:name, s:start_delim, s:end_delim, s:end_group, s:skip] in s:bracketing_delims + 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 + exec "syn region rakuRepl".s:name." matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=@rakuInterp_qq" +endfor +unlet s:name s:start_delim s:end_delim s:end_group s:skip + +" Transliteration + +" tr/foo/bar/, tr|foo|bar, etc +syn region rakuTransliteration + \ matchgroup=rakuQuote + \ start=+\z([/!$,|`"]\)+ + \ skip="\\\z1" + \ end="\z1"me=e-1 + \ contained + \ contains=rakuRxRange + \ nextgroup=rakuTransRepl + +syn region rakuTransRepl + \ matchgroup=rakuQuote + \ start="\z(.\)" + \ skip="\\\z1" + \ end="\z1" + \ contained + \ contains=@rakuInterp_qq,rakuRxRange + +" tr, tr«foo»«bar», tr{foo}{bar}, etc +for [s:name, s:start_delim, s:end_delim, s:end_group, s:skip] in s:bracketing_delims + 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 + 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" +endfor +unlet s:name s:start_delim s:end_delim s:end_group s:skip s:bracketing_delims + +if exists("raku_perl5_regexes") || exists("raku_extended_all") + +" Perl 5 regex regions + +syn cluster rakuRegexP5Base + \ add=rakuRxP5Escape + \ add=rakuRxP5Oct + \ add=rakuRxP5Hex + \ add=rakuRxP5EscMeta + \ add=rakuRxP5CodePoint + \ add=rakuRxP5Prop + +" normal regex stuff +syn cluster rakuRegexP5 + \ add=@rakuRegexP5Base + \ add=rakuRxP5Quantifier + \ add=rakuRxP5Meta + \ add=rakuRxP5QuoteMeta + \ add=rakuRxP5ParenMod + \ add=rakuRxP5Verb + \ add=rakuRxP5Count + \ add=rakuRxP5Named + \ add=rakuRxP5ReadRef + \ add=rakuRxP5WriteRef + \ add=rakuRxP5CharClass + \ add=rakuRxP5Anchor + +" inside character classes +syn cluster rakuRegexP5Class + \ add=@rakuRegexP5Base + \ add=rakuRxP5Posix + \ add=rakuRxP5Range + +syn match rakuRxP5Escape display contained "\\\S" +syn match rakuRxP5CodePoint display contained "\\c\S\@=" nextgroup=rakuRxP5CPId +syn match rakuRxP5CPId display contained "\S" +syn match rakuRxP5Oct display contained "\\\%(\o\{1,3}\)\@=" nextgroup=rakuRxP5OctSeq +syn match rakuRxP5OctSeq display contained "\o\{1,3}" +syn match rakuRxP5Anchor display contained "[\^$]" +syn match rakuRxP5Hex display contained "\\x\%({\x\+}\|\x\{1,2}\)\@=" nextgroup=rakuRxP5HexSeq +syn match rakuRxP5HexSeq display contained "\x\{1,2}" +syn region rakuRxP5HexSeq + \ matchgroup=rakuRxP5Escape + \ start="{" + \ end="}" + \ contained +syn region rakuRxP5Named + \ matchgroup=rakuRxP5Escape + \ start="\%(\\N\)\@2<={" + \ end="}" + \ contained +syn match rakuRxP5Quantifier display contained "\%([+*]\|(\@1" + \ contained +syn match rakuRxP5WriteRef display contained "\\g\%(\d\|{\)\@=" nextgroup=rakuRxP5WriteRefId +syn match rakuRxP5WriteRefId display contained "\d\+" +syn region rakuRxP5WriteRefId + \ matchgroup=rakuRxP5Escape + \ start="{" + \ end="}" + \ contained +syn match rakuRxP5Prop display contained "\\[pP]\%(\a\|{\)\@=" nextgroup=rakuRxP5PropId +syn match rakuRxP5PropId display contained "\a" +syn region rakuRxP5PropId + \ matchgroup=rakuRxP5Escape + \ start="{" + \ end="}" + \ contained +syn match rakuRxP5Meta display contained "[(|).]" +syn match rakuRxP5ParenMod display contained "(\@1<=?\@=" nextgroup=rakuRxP5Mod,rakuRxP5ModName,rakuRxP5Code +syn match rakuRxP5Mod display contained "?\%(<\?=\|<\?!\|[#:|]\)" +syn match rakuRxP5Mod display contained "?-\?[impsx]\+" +syn match rakuRxP5Mod display contained "?\%([-+]\?\d\+\|R\)" +syn match rakuRxP5Mod display contained "?(DEFINE)" +syn match rakuRxP5Mod display contained "?\%(&\|P[>=]\)" nextgroup=rakuRxP5ModDef +syn match rakuRxP5ModDef display contained "\h\w*" +syn region rakuRxP5ModName + \ matchgroup=rakuStringSpecial + \ start="?'" + \ end="'" + \ contained +syn region rakuRxP5ModName + \ matchgroup=rakuStringSpecial + \ start="?P\?<" + \ end=">" + \ contained +syn region rakuRxP5Code + \ matchgroup=rakuStringSpecial + \ start="??\?{" + \ end="})\@=" + \ contained + \ contains=TOP +syn match rakuRxP5EscMeta display contained "\\[?*.{}()[\]|\^$]" +syn match rakuRxP5Count display contained "\%({\d\+\%(,\%(\d\+\)\?\)\?}\)\@=" nextgroup=rakuRxP5CountId +syn region rakuRxP5CountId + \ matchgroup=rakuRxP5Escape + \ start="{" + \ end="}" + \ contained +syn match rakuRxP5Verb display contained "(\@1<=\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\?\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\?\|ACCEPT\)" +syn region rakuRxP5QuoteMeta + \ matchgroup=rakuRxP5Escape + \ start="\\Q" + \ end="\\E" + \ contained + \ contains=@rakuVariables,rakuEscBackSlash +syn region rakuRxP5CharClass + \ matchgroup=rakuStringSpecial + \ start="\[\^\?" + \ skip="\\]" + \ end="]" + \ contained + \ contains=@rakuRegexP5Class +syn region rakuRxP5Posix + \ matchgroup=rakuRxP5Escape + \ start="\[:" + \ end=":]" + \ contained +syn match rakuRxP5Range display contained "-" + +" m:P5// +syn region rakuMatch + \ matchgroup=rakuQuote + \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2 +syn region rakuMatch + \ matchgroup=rakuQuote + \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2\@!" + \ skip="\\>" + \ end=">" + \ contains=@rakuRegexP5,rakuVariables + +" m:P5«» +syn region rakuMatch + \ matchgroup=rakuQuote + \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2]*>" + \ end=">" + \ contains=rakuAttention,rakuBracketComment +syn region rakuBracketComment + \ start="#[`|=]«" + \ skip="«[^»]*»" + \ end="»" + \ contains=rakuAttention,rakuBracketComment + +" Comments with double and triple delimiters +syn region rakuBracketComment + \ matchgroup=rakuBracketComment + \ start="#[`|=]((" + \ skip="((\%([^)\|))\@!]\)*))" + \ end="))" + \ contains=rakuAttention,rakuBracketComment +syn region rakuBracketComment + \ matchgroup=rakuBracketComment + \ start="#[`|=](((" + \ skip="(((\%([^)]\|)\%())\)\@!\)*)))" + \ end=")))" + \ contains=rakuAttention,rakuBracketComment + +syn region rakuBracketComment + \ matchgroup=rakuBracketComment + \ start="#[`|=]\[\[" + \ skip="\[\[\%([^\]]\|]]\@!\)*]]" + \ end="]]" + \ contains=rakuAttention,rakuBracketComment +syn region rakuBracketComment + \ matchgroup=rakuBracketComment + \ start="#[`|=]\[\[\[" + \ skip="\[\[\[\%([^\]]\|]\%(]]\)\@!\)*]]]" + \ end="]]]" + \ contains=rakuAttention,rakuBracketComment + +syn region rakuBracketComment + \ matchgroup=rakuBracketComment + \ start="#[`|=]{{" + \ skip="{{\%([^}]\|}}\@!\)*}}" + \ end="}}" + \ contains=rakuAttention,rakuBracketComment +syn region rakuBracketComment + \ matchgroup=rakuBracketComment + \ start="#[`|=]{{{" + \ skip="{{{\%([^}]\|}\%(}}\)\@!\)*}}}" + \ end="}}}" + \ contains=rakuAttention,rakuBracketComment + +syn region rakuBracketComment + \ matchgroup=rakuBracketComment + \ start="#[`|=]<<" + \ skip="<<\%([^>]\|>>\@!\)*>>" + \ end=">>" + \ contains=rakuAttention,rakuBracketComment +syn region rakuBracketComment + \ matchgroup=rakuBracketComment + \ start="#[`|=]<<<" + \ skip="<<<\%([^>]\|>\%(>>\)\@!\)*>>>" + \ end=">>>" + \ contains=rakuAttention,rakuBracketComment + +syn region rakuBracketComment + \ matchgroup=rakuBracketComment + \ start="#[`|=]««" + \ skip="««\%([^»]\|»»\@!\)*»»" + \ end="»»" + \ contains=rakuAttention,rakuBracketComment +syn region rakuBracketComment + \ matchgroup=rakuBracketComment + \ start="#[`|=]«««" + \ skip="«««\%([^»]\|»\%(»»\)\@!\)*»»»" + \ end="»»»" + \ contains=rakuAttention,rakuBracketComment + +syn match rakuShebang display "\%^#!.*" + +" => autoquoting +syn match rakuStringAuto display "\.\@1" +syn match rakuStringAuto display "\.\@1" +syn match rakuStringAuto display "\.\@1" + +" Pod + +" Abbreviated blocks (implicit code forbidden) +syn region rakuPodAbbrRegion + \ matchgroup=rakuPodPrefix + \ start="^\s*\zs=\ze\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contains=rakuPodAbbrNoCodeType + \ keepend + +syn region rakuPodAbbrNoCodeType + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + \ contains=rakuPodName,rakuPodAbbrNoCode + +syn match rakuPodName contained ".\+" contains=@rakuPodFormat +syn match rakuPodComment contained ".\+" + +syn region rakuPodAbbrNoCode + \ start="^" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + \ contains=@rakuPodFormat + +" Abbreviated blocks (everything is code) +syn region rakuPodAbbrRegion + \ matchgroup=rakuPodPrefix + \ start="^\s*\zs=\zecode\>" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contains=rakuPodAbbrCodeType + \ keepend + +syn region rakuPodAbbrCodeType + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + \ contains=rakuPodName,rakuPodAbbrCode + +syn region rakuPodAbbrCode + \ start="^" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + +" Abbreviated blocks (everything is a comment) +syn region rakuPodAbbrRegion + \ matchgroup=rakuPodPrefix + \ start="^=\zecomment\>" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contains=rakuPodAbbrCommentType + \ keepend + +syn region rakuPodAbbrCommentType + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + \ contains=rakuPodComment,rakuPodAbbrNoCode + +" Abbreviated blocks (implicit code allowed) +syn region rakuPodAbbrRegion + \ matchgroup=rakuPodPrefix + \ start="^=\ze\%(pod\|item\|nested\|\u\+\)\>" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contains=rakuPodAbbrType + \ keepend + +syn region rakuPodAbbrType + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + \ contains=rakuPodName,rakuPodAbbr + +syn region rakuPodAbbr + \ start="^" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + \ contains=@rakuPodFormat,rakuPodImplicitCode + +" Abbreviated block to end-of-file +syn region rakuPodAbbrRegion + \ matchgroup=rakuPodPrefix + \ start="^=\zeEND\>" + \ end="\%$" + \ contains=rakuPodAbbrEOFType + \ keepend + +syn region rakuPodAbbrEOFType + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="\%$" + \ contained + \ contains=rakuPodName,rakuPodAbbrEOF + +syn region rakuPodAbbrEOF + \ start="^" + \ end="\%$" + \ contained + \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode + +" Directives +syn region rakuPodDirectRegion + \ matchgroup=rakuPodPrefix + \ start="^=\%(config\|use\)\>" + \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" + \ contains=rakuPodDirectArgRegion + \ keepend + +syn region rakuPodDirectArgRegion + \ matchgroup=rakuPodType + \ start="\S\+" + \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" + \ contained + \ contains=rakuPodDirectConfigRegion + +syn region rakuPodDirectConfigRegion + \ start="" + \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" + \ contained + \ contains=@rakuPodConfig + +" =encoding is a special directive +syn region rakuPodDirectRegion + \ matchgroup=rakuPodPrefix + \ start="^=encoding\>" + \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" + \ contains=rakuPodEncodingArgRegion + \ keepend + +syn region rakuPodEncodingArgRegion + \ matchgroup=rakuPodName + \ start="\S\+" + \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" + \ contained + +" Paragraph blocks (implicit code forbidden) +syn region rakuPodParaRegion + \ matchgroup=rakuPodPrefix + \ start="^\s*\zs=for\>" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contains=rakuPodParaNoCodeTypeRegion + \ keepend extend + +syn region rakuPodParaNoCodeTypeRegion + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + \ contains=rakuPodParaNoCode,rakuPodParaConfigRegion + +syn region rakuPodParaConfigRegion + \ start="" + \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\@1\ze\s*code\>" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contains=rakuPodParaCodeTypeRegion + \ keepend extend + +syn region rakuPodParaCodeTypeRegion + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + \ contains=rakuPodParaCode,rakuPodParaConfigRegion + +syn region rakuPodParaCode + \ start="^[^=]" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + +" Paragraph blocks (implicit code allowed) +syn region rakuPodParaRegion + \ matchgroup=rakuPodPrefix + \ start="^\s*\zs=for\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>" + \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contains=rakuPodParaTypeRegion + \ keepend extend + +syn region rakuPodParaTypeRegion + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + \ contains=rakuPodPara,rakuPodParaConfigRegion + +syn region rakuPodPara + \ start="^[^=]" + \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" + \ contained + \ contains=@rakuPodFormat,rakuPodImplicitCode + +" Paragraph block to end-of-file +syn region rakuPodParaRegion + \ matchgroup=rakuPodPrefix + \ start="^=for\>\ze\s\+END\>" + \ end="\%$" + \ contains=rakuPodParaEOFTypeRegion + \ keepend extend + +syn region rakuPodParaEOFTypeRegion + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="\%$" + \ contained + \ contains=rakuPodParaEOF,rakuPodParaConfigRegion + +syn region rakuPodParaEOF + \ start="^[^=]" + \ end="\%$" + \ contained + \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode + +" Delimited blocks (implicit code forbidden) +syn region rakuPodDelimRegion + \ matchgroup=rakuPodPrefix + \ start="^\z(\s*\)\zs=begin\>" + \ end="^\z1\zs=end\>" + \ contains=rakuPodDelimNoCodeTypeRegion + \ keepend extend skipwhite + \ nextgroup=rakuPodType + +syn region rakuPodDelimNoCodeTypeRegion + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\s*\zs\ze=end\>" + \ contained + \ contains=rakuPodDelimNoCode,rakuPodDelimConfigRegion + +syn region rakuPodDelimConfigRegion + \ start="" + \ end="^\s*\zs\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" + \ contained + \ contains=@rakuPodConfig + +syn region rakuPodDelimNoCode + \ start="^" + \ end="^\s*\zs\ze=end\>" + \ contained + \ contains=@rakuPodNestedBlocks,@rakuPodFormat + +" Delimited blocks (everything is code) +syn region rakuPodDelimRegion + \ matchgroup=rakuPodPrefix + \ start="^\z(\s*\)\zs=begin\>\ze\s*code\>" + \ end="^\z1\zs=end\>" + \ contains=rakuPodDelimCodeTypeRegion + \ keepend extend skipwhite + \ nextgroup=rakuPodType + +syn region rakuPodDelimCodeTypeRegion + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\s*\zs\ze=end\>" + \ contained + \ contains=rakuPodDelimCode,rakuPodDelimConfigRegion + +syn region rakuPodDelimCode + \ start="^" + \ end="^\s*\zs\ze=end\>" + \ contained + \ contains=@rakuPodNestedBlocks + +" Delimited blocks (implicit code allowed) +syn region rakuPodDelimRegion + \ matchgroup=rakuPodPrefix + \ start="^\z(\s*\)\zs=begin\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>" + \ end="^\z1\zs=end\>" + \ contains=rakuPodDelimTypeRegion + \ keepend extend skipwhite + \ nextgroup=rakuPodType + +syn region rakuPodDelimTypeRegion + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="^\s*\zs\ze=end\>" + \ contained + \ contains=rakuPodDelim,rakuPodDelimConfigRegion + +syn region rakuPodDelim + \ start="^" + \ end="^\s*\zs\ze=end\>" + \ contained + \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode + +" Delimited block to end-of-file +syn region rakuPodDelimRegion + \ matchgroup=rakuPodPrefix + \ start="^=begin\>\ze\s\+END\>" + \ end="\%$" + \ extend + \ contains=rakuPodDelimEOFTypeRegion + +syn region rakuPodDelimEOFTypeRegion + \ matchgroup=rakuPodType + \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + \ end="\%$" + \ contained + \ contains=rakuPodDelimEOF,rakuPodDelimConfigRegion + +syn region rakuPodDelimEOF + \ start="^" + \ end="\%$" + \ contained + \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode + +syn cluster rakuPodConfig + \ add=rakuPodConfigOperator + \ add=rakuPodExtraConfig + \ add=rakuStringAuto + \ add=rakuPodAutoQuote + \ add=rakuStringSQ + +syn region rakuPodParens + \ start="(" + \ end=")" + \ contained + \ contains=rakuNumber,rakuStringSQ + +syn match rakuPodAutoQuote display contained "=>" +syn match rakuPodConfigOperator display contained ":!\?" nextgroup=rakuPodConfigOption +syn match rakuPodConfigOption display contained "[^[:space:](<]\+" nextgroup=rakuPodParens,rakuStringAngle +syn match rakuPodExtraConfig display contained "^=" +syn match rakuPodVerticalBar display contained "|" +syn match rakuPodColon display contained ":" +syn match rakuPodSemicolon display contained ";" +syn match rakuPodComma display contained "," +syn match rakuPodImplicitCode display contained "^\s.*" +syn match rakuPodType display contained "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" + +" These may appear inside delimited blocks +syn cluster rakuPodNestedBlocks + \ add=rakuPodAbbrRegion + \ add=rakuPodDirectRegion + \ add=rakuPodParaRegion + \ add=rakuPodDelimRegion + +" Pod formatting codes + +syn cluster rakuPodFormat + \ add=rakuPodFormatOne + \ add=rakuPodFormatTwo + \ add=rakuPodFormatThree + \ add=rakuPodFormatFrench + +" Balanced angles found inside formatting codes. Ensures proper nesting. + +syn region rakuPodFormatAnglesOne + \ matchgroup=rakuPodFormat + \ start="<" + \ skip="<[^>]*>" + \ end=">" + \ transparent contained + \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne + +syn region rakuPodFormatAnglesTwo + \ matchgroup=rakuPodFormat + \ start="<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ transparent contained + \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne,rakuPodFormatAnglesTwo + +syn region rakuPodFormatAnglesThree + \ matchgroup=rakuPodFormat + \ start="<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ transparent contained + \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne,rakuPodFormatAnglesTwo,rakuPodFormatAnglesThree + +syn region rakuPodFormatAnglesFrench + \ matchgroup=rakuPodFormat + \ start="«" + \ skip="«[^»]*»" + \ end="»" + \ transparent contained + \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne,rakuPodFormatAnglesTwo,rakuPodFormatAnglesThree + +" All formatting codes + +syn region rakuPodFormatOne + \ matchgroup=rakuPodFormatCode + \ start="\u<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne + +syn region rakuPodFormatTwo + \ matchgroup=rakuPodFormatCode + \ start="\u<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo + +syn region rakuPodFormatThree + \ matchgroup=rakuPodFormatCode + \ start="\u<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree + +syn region rakuPodFormatFrench + \ matchgroup=rakuPodFormatCode + \ start="\u«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree + +" C<> and V<> don't allow nested formatting formatting codes + +syn region rakuPodFormatOne + \ matchgroup=rakuPodFormatCode + \ start="[CV]<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=rakuPodFormatAnglesOne + +syn region rakuPodFormatTwo + \ matchgroup=rakuPodFormatCode + \ start="[CV]<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=rakuPodFormatAnglesTwo + +syn region rakuPodFormatThree + \ matchgroup=rakuPodFormatCode + \ start="[CV]<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=rakuPodFormatAnglesThree + +syn region rakuPodFormatFrench + \ matchgroup=rakuPodFormatCode + \ start="[CV]«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=rakuPodFormatAnglesFrench + +" L<> can have a "|" separator + +syn region rakuPodFormatOne + \ matchgroup=rakuPodFormatCode + \ start="L<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodVerticalBar + +syn region rakuPodFormatTwo + \ matchgroup=rakuPodFormatCode + \ start="L<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodVerticalBar + +syn region rakuPodFormatThree + \ matchgroup=rakuPodFormatCode + \ start="L<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar + +syn region rakuPodFormatFrench + \ matchgroup=rakuPodFormatCode + \ start="L«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar + +" E<> can have a ";" separator + +syn region rakuPodFormatOne + \ matchgroup=rakuPodFormatCode + \ start="E<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodSemiColon + +syn region rakuPodFormatTwo + \ matchgroup=rakuPodFormatCode + \ start="E<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodSemiColon + +syn region rakuPodFormatThree + \ matchgroup=rakuPodFormatCode + \ start="E<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodSemiColon + +syn region rakuPodFormatFrench + \ matchgroup=rakuPodFormatCode + \ start="E«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodSemiColon + +" M<> can have a ":" separator + +syn region rakuPodFormatOne + \ matchgroup=rakuPodFormatCode + \ start="M<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodColon + +syn region rakuPodFormatTwo + \ matchgroup=rakuPodFormatCode + \ start="M<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodColon + +syn region rakuPodFormatThree + \ matchgroup=rakuPodFormatCode + \ start="M<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodColon + +syn region rakuPodFormatFrench + \ matchgroup=rakuPodFormatCode + \ start="M«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodColon + +" D<> can have "|" and ";" separators + +syn region rakuPodFormatOne + \ matchgroup=rakuPodFormatCode + \ start="D<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodVerticalBar,rakuPodSemiColon + +syn region rakuPodFormatTwo + \ matchgroup=rakuPodFormatCode + \ start="D<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=rakuPodFormatAngleTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodVerticalBar,rakuPodSemiColon + +syn region rakuPodFormatThree + \ matchgroup=rakuPodFormatCode + \ start="D<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon + +syn region rakuPodFormatFrench + \ matchgroup=rakuPodFormatCode + \ start="D«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon + +" X<> can have "|", "," and ";" separators + +syn region rakuPodFormatOne + \ matchgroup=rakuPodFormatCode + \ start="X<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma + +syn region rakuPodFormatTwo + \ matchgroup=rakuPodFormatCode + \ start="X<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma + +syn region rakuPodFormatThree + \ matchgroup=rakuPodFormatCode + \ start="X<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma + +syn region rakuPodFormatFrench + \ matchgroup=rakuPodFormatCode + \ start="X«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_raku_syntax_inits") + if version < 508 + let did_raku_syntax_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink rakuEscOctOld rakuError + HiLink rakuPackageTwigil rakuTwigil + HiLink rakuStringAngle rakuString + HiLink rakuStringAngleFixed rakuString + HiLink rakuStringFrench rakuString + HiLink rakuStringAngles rakuString + HiLink rakuStringSQ rakuString + HiLink rakuStringDQ rakuString + HiLink rakuStringQ rakuString + HiLink rakuStringQ_q rakuString + HiLink rakuStringQ_qww rakuString + HiLink rakuStringQ_qq rakuString + HiLink rakuStringQ_to rakuString + HiLink rakuStringQ_qto rakuString + HiLink rakuStringQ_qqto rakuString + HiLink rakuRxStringSQ rakuString + HiLink rakuRxStringDQ rakuString + HiLink rakuReplacement rakuString + HiLink rakuReplCurly rakuString + HiLink rakuReplAngle rakuString + HiLink rakuReplFrench rakuString + HiLink rakuReplBracket rakuString + HiLink rakuReplParen rakuString + HiLink rakuTransliteration rakuString + HiLink rakuTransRepl rakuString + HiLink rakuTransReplCurly rakuString + HiLink rakuTransReplAngle rakuString + HiLink rakuTransReplFrench rakuString + HiLink rakuTransReplBracket rakuString + HiLink rakuTransReplParen rakuString + HiLink rakuStringAuto rakuString + HiLink rakuKey rakuString + HiLink rakuMatch rakuString + HiLink rakuSubstitution rakuString + HiLink rakuMatchBare rakuString + HiLink rakuRegexBlock rakuString + HiLink rakuRxP5CharClass rakuString + HiLink rakuRxP5QuoteMeta rakuString + HiLink rakuRxCharClass rakuString + HiLink rakuRxQuoteWords rakuString + HiLink rakuReduceOp rakuOperator + HiLink rakuSetOp rakuOperator + HiLink rakuRSXZOp rakuOperator + HiLink rakuHyperOp rakuOperator + HiLink rakuPostHyperOp rakuOperator + HiLink rakuQuoteQ rakuQuote + HiLink rakuQuoteQ_q rakuQuote + HiLink rakuQuoteQ_qww rakuQuote + HiLink rakuQuoteQ_qq rakuQuote + HiLink rakuQuoteQ_to rakuQuote + HiLink rakuQuoteQ_qto rakuQuote + HiLink rakuQuoteQ_qqto rakuQuote + HiLink rakuQuoteQ_PIR rakuQuote + HiLink rakuMatchStart_m rakuQuote + HiLink rakuMatchStart_s rakuQuote + HiLink rakuMatchStart_tr rakuQuote + HiLink rakuBareSigil rakuVariable + HiLink rakuRxRange rakuStringSpecial + HiLink rakuRxAnchor rakuStringSpecial + HiLink rakuRxBoundary rakuStringSpecial + HiLink rakuRxP5Anchor rakuStringSpecial + HiLink rakuCodePoint rakuStringSpecial + HiLink rakuRxMeta rakuStringSpecial + HiLink rakuRxP5Range rakuStringSpecial + HiLink rakuRxP5CPId rakuStringSpecial + HiLink rakuRxP5Posix rakuStringSpecial + HiLink rakuRxP5Mod rakuStringSpecial + HiLink rakuRxP5HexSeq rakuStringSpecial + HiLink rakuRxP5OctSeq rakuStringSpecial + HiLink rakuRxP5WriteRefId rakuStringSpecial + HiLink rakuHexSequence rakuStringSpecial + HiLink rakuOctSequence rakuStringSpecial + HiLink rakuRxP5Named rakuStringSpecial + HiLink rakuRxP5PropId rakuStringSpecial + HiLink rakuRxP5Quantifier rakuStringSpecial + HiLink rakuRxP5CountId rakuStringSpecial + HiLink rakuRxP5Verb rakuStringSpecial + HiLink rakuRxAssertGroup rakuStringSpecial2 + HiLink rakuEscape rakuStringSpecial2 + HiLink rakuEscNull rakuStringSpecial2 + HiLink rakuEscHash rakuStringSpecial2 + HiLink rakuEscQQ rakuStringSpecial2 + HiLink rakuEscQuote rakuStringSpecial2 + HiLink rakuEscDoubleQuote rakuStringSpecial2 + HiLink rakuEscBackTick rakuStringSpecial2 + HiLink rakuEscForwardSlash rakuStringSpecial2 + HiLink rakuEscVerticalBar rakuStringSpecial2 + HiLink rakuEscExclamation rakuStringSpecial2 + HiLink rakuEscDollar rakuStringSpecial2 + HiLink rakuEscOpenCurly rakuStringSpecial2 + HiLink rakuEscCloseCurly rakuStringSpecial2 + HiLink rakuEscCloseBracket rakuStringSpecial2 + HiLink rakuEscCloseAngle rakuStringSpecial2 + HiLink rakuEscCloseFrench rakuStringSpecial2 + HiLink rakuEscBackSlash rakuStringSpecial2 + HiLink rakuEscCodePoint rakuStringSpecial2 + HiLink rakuEscOct rakuStringSpecial2 + HiLink rakuEscHex rakuStringSpecial2 + HiLink rakuRxEscape rakuStringSpecial2 + HiLink rakuRxCapture rakuStringSpecial2 + HiLink rakuRxAlternation rakuStringSpecial2 + HiLink rakuRxP5 rakuStringSpecial2 + HiLink rakuRxP5ReadRef rakuStringSpecial2 + HiLink rakuRxP5Oct rakuStringSpecial2 + HiLink rakuRxP5Hex rakuStringSpecial2 + HiLink rakuRxP5EscMeta rakuStringSpecial2 + HiLink rakuRxP5Meta rakuStringSpecial2 + HiLink rakuRxP5Escape rakuStringSpecial2 + HiLink rakuRxP5CodePoint rakuStringSpecial2 + HiLink rakuRxP5WriteRef rakuStringSpecial2 + HiLink rakuRxP5Prop rakuStringSpecial2 + + HiLink rakuProperty Tag + HiLink rakuAttention Todo + HiLink rakuType Type + HiLink rakuError Error + HiLink rakuBlockLabel Label + HiLink rakuNormal Normal + HiLink rakuIdentifier Normal + HiLink rakuPackage Normal + HiLink rakuPackageScope Normal + HiLink rakuNumber Number + HiLink rakuOctNumber Number + HiLink rakuBinNumber Number + HiLink rakuHexNumber Number + HiLink rakuDecNumber Number + HiLink rakuString String + HiLink rakuRepeat Repeat + HiLink rakuPragma Keyword + HiLink rakuPreDeclare Keyword + HiLink rakuDeclare Keyword + HiLink rakuDeclareRegex Keyword + HiLink rakuVarStorage Special + HiLink rakuFlowControl Special + HiLink rakuOctBase Special + HiLink rakuBinBase Special + HiLink rakuHexBase Special + HiLink rakuDecBase Special + HiLink rakuTwigil Special + HiLink rakuStringSpecial2 Special + HiLink rakuVersion Special + HiLink rakuComment Comment + HiLink rakuBracketComment Comment + HiLink rakuInclude Include + HiLink rakuShebang PreProc + HiLink rakuClosureTrait PreProc + HiLink rakuOperator Operator + HiLink rakuContext Operator + HiLink rakuQuote Delimiter + HiLink rakuTypeConstraint PreCondit + HiLink rakuException Exception + HiLink rakuVariable Identifier + HiLink rakuVarSlash Identifier + HiLink rakuVarNum Identifier + HiLink rakuVarExclam Identifier + HiLink rakuVarMatch Identifier + HiLink rakuVarName Identifier + HiLink rakuMatchVar Identifier + HiLink rakuRxP5ReadRefId Identifier + HiLink rakuRxP5ModDef Identifier + HiLink rakuRxP5ModName Identifier + HiLink rakuConditional Conditional + HiLink rakuStringSpecial SpecialChar + + HiLink rakuPodAbbr rakuPod + HiLink rakuPodAbbrEOF rakuPod + HiLink rakuPodAbbrNoCode rakuPod + HiLink rakuPodAbbrCode rakuPodCode + HiLink rakuPodPara rakuPod + HiLink rakuPodParaEOF rakuPod + HiLink rakuPodParaNoCode rakuPod + HiLink rakuPodParaCode rakuPodCode + HiLink rakuPodDelim rakuPod + HiLink rakuPodDelimEOF rakuPod + HiLink rakuPodDelimNoCode rakuPod + HiLink rakuPodDelimCode rakuPodCode + HiLink rakuPodImplicitCode rakuPodCode + HiLink rakuPodExtraConfig rakuPodPrefix + HiLink rakuPodVerticalBar rakuPodFormatCode + HiLink rakuPodColon rakuPodFormatCode + HiLink rakuPodSemicolon rakuPodFormatCode + HiLink rakuPodComma rakuPodFormatCode + HiLink rakuPodFormatOne rakuPodFormat + HiLink rakuPodFormatTwo rakuPodFormat + HiLink rakuPodFormatThree rakuPodFormat + HiLink rakuPodFormatFrench rakuPodFormat + + HiLink rakuPodType Type + HiLink rakuPodConfigOption String + HiLink rakuPodCode PreProc + HiLink rakuPod Comment + HiLink rakuPodComment Comment + HiLink rakuPodAutoQuote Operator + HiLink rakuPodConfigOperator Operator + HiLink rakuPodPrefix Statement + HiLink rakuPodName Identifier + HiLink rakuPodFormatCode SpecialChar + HiLink rakuPodFormat SpecialComment + + delcommand HiLink +endif + +if exists("raku_fold") || exists("raku_extended_all") + setl foldmethod=syntax + syn region rakuBlockFold + \ 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*\%(#.*\)\?\)\?$" + \ end="^\z1}" + \ transparent fold keepend extend +endif + +let b:current_syntax = "raku" + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim:ts=8:sts=4:sw=4:expandtab:ft=vim diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim --- a/runtime/syntax/rmd.vim +++ b/runtime/syntax/rmd.vim @@ -1,7 +1,7 @@ " markdown Text with R statements " Language: markdown with R code chunks " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Thu Apr 18, 2019 09:17PM +" Last Change: Wed Apr 21, 2021 09:55AM " " For highlighting pandoc extensions to markdown like citations and TeX and " many other advanced features like folding of markdown sections, it is @@ -13,27 +13,45 @@ if exists("b:current_syntax") finish endif -" Configuration if not using pandoc syntax: -" Add syntax highlighting of YAML header -let g:rmd_syn_hl_yaml = get(g:, 'rmd_syn_hl_yaml', 1) -" Add syntax highlighting of citation keys -let g:rmd_syn_hl_citations = get(g:, 'rmd_syn_hl_citations', 1) -" Highlight the header of the chunk of R code -let g:rmd_syn_hl_chunk = get(g:, 'g:rmd_syn_hl_chunk', 0) +" Highlight the header of the chunks as R code +let g:rmd_syn_hl_chunk = get(g:, 'rmd_syn_hl_chunk', 0) " Pandoc-syntax has more features, but it is slower. " https://github.com/vim-pandoc/vim-pandoc-syntax let g:pandoc#syntax#codeblocks#embeds#langs = get(g:, 'pandoc#syntax#codeblocks#embeds#langs', ['r']) runtime syntax/pandoc.vim if exists("b:current_syntax") - " Fix recognition of R code - syn region pandocDelimitedCodeBlock_r start=/^```{r\>.*}$/ end=/^```$/ contained containedin=pandocDelimitedCodeBlock contains=@R + " Recognize inline R code syn region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@R containedin=pandocLaTeXRegion,yamlFlowString keepend hi def link rmdInlineDelim Delimiter + + " Fix recognition of language chunks (code adapted from pandoc, 2021-03-28) + " Knitr requires braces in the block's header + for s:lng in g:pandoc#syntax#codeblocks#embeds#langs + let s:nm = matchstr(s:lng, '^[^=]*') + exe 'syn clear pandocDelimitedCodeBlock_'.s:nm + exe 'syn clear pandocDelimitedCodeBlockinBlockQuote_'.s:nm + if g:rmd_syn_hl_chunk + exe 'syn region rmd'.s:nm.'ChunkDelim matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>" matchgroup=rmdCodeDelim end="}$" keepend containedin=rmd'.s:nm.'Chunk contains=@R' + exe 'syn region rmd'.s:nm.'Chunk start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=rmd'.s:nm.'ChunkDelim,@'.toupper(s:nm) + else + exe 'syn region rmd'.s:nm.'Chunk matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=@'.toupper(s:nm) + endif + endfor + unlet s:lng + unlet s:nm + hi def link rmdInlineDelim Delimiter + hi def link rmdCodeDelim Delimiter let b:current_syntax = "rmd" finish endif +" Configuration if not using pandoc syntax: +" Add syntax highlighting of YAML header +let g:rmd_syn_hl_yaml = get(g:, 'rmd_syn_hl_yaml', 1) +" Add syntax highlighting of citation keys +let g:rmd_syn_hl_citations = get(g:, 'rmd_syn_hl_citations', 1) + let s:cpo_save = &cpo set cpo&vim @@ -63,15 +81,17 @@ for s:type in g:rmd_fenced_languages unlet! b:current_syntax exe 'syn include @Rmd'.s:nm.' syntax/'.s:ft.'.vim' if g:rmd_syn_hl_chunk - exe 'syn region rmd'.s:nm.'ChunkDelim matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>" matchgroup=rmdCodeDelim end="}$" keepend containedin=rmd'.s:nm.'Chunk contains=@Rmd'.s:nm + exe 'syn region rmd'.s:nm.'ChunkDelim matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>" matchgroup=rmdCodeDelim end="}$" keepend containedin=rmd'.s:nm.'Chunk contains=@Rmdr' exe 'syn region rmd'.s:nm.'Chunk start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=rmd'.s:nm.'ChunkDelim,@Rmd'.s:nm else exe 'syn region rmd'.s:nm.'Chunk matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=@Rmd'.s:nm endif - exe 'syn region rmd'.s:nm.'Inline matchgroup=rmdInlineDelim start="`'.s:nm.' " end="`" contains=@Rmd'.s:nm.' keepend' endfor unlet! s:type +" Recognize inline R code +syn region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@Rmdr keepend + hi def link rmdInlineDelim Delimiter hi def link rmdCodeDelim Delimiter diff --git a/runtime/syntax/rnoweb.vim b/runtime/syntax/rnoweb.vim --- a/runtime/syntax/rnoweb.vim +++ b/runtime/syntax/rnoweb.vim @@ -33,8 +33,8 @@ syn cluster texParaGroup add=@rnoweb " Highlighting of R code using an existing r.vim syntax file if available {{{1 syn include @rnowebR syntax/r.vim -syn region rnowebChunk matchgroup=rnowebDelimiter start="^<<.*>>=" matchgroup=rnowebDelimiter end="^@" contains=@rnowebR,rnowebChunkReference,rnowebChunk fold keepend -syn match rnowebChunkReference "^<<.*>>$" contained +syn region rnowebChunk matchgroup=rnowebDelimiter start="^\s*<<.*>>=" matchgroup=rnowebDelimiter end="^@" contains=@rnowebR,rnowebChunkReference,rnowebChunk fold keepend +syn match rnowebChunkReference "^\s*<<.*>>$" contained syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR contained " Sweave options command {{{1 diff --git a/runtime/tutor/tutor.tr.iso9 b/runtime/tutor/tutor.tr.iso9 --- a/runtime/tutor/tutor.tr.iso9 +++ b/runtime/tutor/tutor.tr.iso9 @@ -682,7 +682,7 @@ Not: Arama dosyann sonuna ulatnda dosyann bandan srecektir. Bunu Ders 5.3'n iki adet kopyas olduunu grn, zgn srm ve kopyas. NOT: Bu komutu kullanarak bir d komutun ktsn da dosyann iine - koyabilirsiniz. rnein :r :!ls yazmak ls komutunun verecei kty + koyabilirsiniz. rnein :r !ls yazmak ls komutunun verecei kty dosyann iinde hemen imlecin altndaki satra koyar. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/INSTALL b/src/INSTALL --- a/src/INSTALL +++ b/src/INSTALL @@ -39,7 +39,7 @@ version of Vim that is small and starts to disable the GUI and X11. If you don't have GUI libraries and/or X11, these features will be disabled automatically. -To built Vim on Ubuntu from scratch on a clean system using git: +To build Vim on Ubuntu from scratch on a clean system using git: Install tools required to be able to get and build Vim: % sudo apt install git % sudo apt install make