mirror of
1
0
Fork 0

Add support for scheme/racket.

This commit is contained in:
Kurtis Moxley 2022-05-28 10:42:11 +08:00
parent a1ecf4e940
commit ea73a5a99d
10 changed files with 587 additions and 0 deletions

View File

@ -0,0 +1,19 @@
Copyright (c) 2019 HiPhish
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,42 @@
.. default-role:: code
###########################
GNU Guile support for Vim
###########################
This plugin extends Vim's Scheme support to include the additions to the
language provided by the `GNU Guile`_ implementation. The plugin automatically
detects whether a Scheme file is a Guile file and adds syntax highlighting for
Guile's special forms.
Installation
############
Install this like any other Vim plugin.
Using the plugin
################
When a Guile buffer has been detected its `filetype` option will be set to the
value `scheme.guile`. This uses Vim's dotted file type (see `:h 'filetype'`) in
order to allow users to keep using their setting any plugins for Scheme in
addition to this.
Guile is detected by either looking for a shebang in the first line (see
`4.3.1 The Top of a Script File`_ in the Guile manual), or by scanning the file
for an occurrence of `define-module` or `use-modules`. This is not absolutely
reliable, but it should work for the vast majority of cases.
License
#######
Released under the MIT (Expat) license, see the COPYING_ file for details.
.. ----------------------------------------------------------------------------
.. _GNU Guile: http://www.gnu.org/software/guile/
.. _COPYING: COPYING.txt
.. _4.3.1 The Top of a Script File: info:guile.info#The%20Top%20of%20a%20Script%20File

View File

@ -0,0 +1,43 @@
" License: The MIT License (MIT) {{{
" Copyright (c) 2019 HiPhish
"
" Permission is hereby granted, free of charge, to any person obtaining a
" copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to permit
" persons to whom the Software is furnished to do so, subject to the
" following conditions:
"
" The above copyright notice and this permission notice shall be included
" in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
" NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
" USE OR OTHER DEALINGS IN THE SOFTWARE.
" }}}
" -----------------------------------------------------------------------------
" Detect whether the file is a Guile file.
"
" Try to find Guile-specific forms, e.g. the Guile shebang or a define-module
" expression.
" -----------------------------------------------------------------------------
function! guile#detect()
" Guile uses the shebang in the first line
if getline(1) =~? '\v^#!.*[Gg]uile'
return 1
endif
" Search for a module definition
let l:save_cursor = getcurpos()
call cursor(1, 1)
if search('\v\(\s*(define-module|use-modules)\s*\(', 'c', 0, 1000)
return 1
endif
call setpos('.', l:save_cursor)
return 0
endfunction

View File

@ -0,0 +1,36 @@
" License: The MIT License (MIT) {{{
" Copyright (c) 2019 HiPhish
"
" Permission is hereby granted, free of charge, to any person obtaining a
" copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to permit
" persons to whom the Software is furnished to do so, subject to the
" following conditions:
"
" The above copyright notice and this permission notice shall be included
" in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
" NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
" USE OR OTHER DEALINGS IN THE SOFTWARE.
" }}}
" Safely adjust to file type to not include `guile` more than once
function! s:adjust_ft()
for l:ft in split(&filetype, '\v\.')
if l:ft == 'guile'
return
endif
endfor
let &ft.='.guile'
endfunction
augroup filetypedetect
autocmd BufRead,BufNewFile *scm if guile#detect() | call s:adjust_ft() | endif
augroup end

View File

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
viewBox="0 0 511.99995 512"
id="svg4268"
version="1.1"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="logo.svg">
<defs
id="defs4270" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.71223882"
inkscape:cx="396.59138"
inkscape:cy="218.04935"
inkscape:document-units="px"
inkscape:current-layer="g3880"
showgrid="false"
units="px"
height="200px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1253"
inkscape:window-height="685"
inkscape:window-x="421"
inkscape:window-y="220"
inkscape:window-maximized="0" />
<metadata
id="metadata4273">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Capa 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-540.36216)">
<g
transform="translate(747.52659,-1312.6768)"
id="g3880"
inkscape:export-filename="favicon.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<path
sodipodi:nodetypes="ccsccsc"
inkscape:connector-curvature="0"
style="fill:#f2f2f2;fill-opacity:0.9956522;stroke:none;stroke-width:2.58588266"
d="m -461.9174,1885.039 v 65.7391 c 74.01318,14.0043 130.02299,79.5383 130.02299,158.2609 0,78.7225 -56.00981,144.2562 -130.02299,158.2608 v 65.7392 c 109.72779,-14.6046 194.39081,-109.3294 194.39081,-224 0,-114.6709 -84.66302,-209.3955 -194.39081,-224 z"
id="path4028" />
<g
transform="matrix(0.59020223,0,0,0.59020223,-698.53366,1863.4146)"
id="layer1-3">
<g
transform="matrix(1.532388,0,0,1.3939671,-54.912136,-41.792396)"
id="g3699">
<path
style="fill:#019833;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 260.50744,170.69515 105.98412,340.79094 259.8636,510.178 414.38691,340.08221 Z"
id="path2836"
inkscape:connector-curvature="0" />
<path
style="fill:#66fe98;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 259.8636,171.40389 V 156.52051 L 91.819492,341.49967 h 14.164628 z"
id="path2838"
inkscape:connector-curvature="0" />
<path
id="path2840"
d="m 259.47729,171.40389 v -14.88338 l 168.0441,184.97916 h -14.16463 z"
style="fill:#45fe02;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
id="path2842"
d="M 259.8636,511.17022 V 526.0536 L 91.819492,341.07444 h 14.164628 z"
style="fill:#017d17;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:18.91431427;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 122.99448,175.30643 h 108.35396 l 6.60139,7.26665 v 22.30116 l -5.23559,7.01608 H 220.87725 V 322.64438 L 322.85744,211.89032 H 306.0125 l -5.9185,-7.01608 v -23.55403 l 5.46323,-5.51264 h 109.71976 l 5.46322,6.01379 v 22.05058 L 172.61878,484.01452 H 144.39212 L 136.22179,478.822 V 210.88803 h -13.68257 l -5.00795,-5.51264 v -23.55403 z"
id="path3650"
inkscape:connector-curvature="0" />
<path
style="fill:#005d04;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 259.47729,511.17022 V 526.0536 L 427.52139,341.07444 H 413.35676 Z"
id="path2844"
inkscape:connector-curvature="0" />
<path
id="path2846"
d="M 259.41018,155.14848 90.734026,340.82339 258.70737,525.72467 427.38353,340.04975 Z"
style="fill:none;stroke:#000000;stroke-width:5.67429399;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
style="fill:#fefefe;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 232.50008,186.64163 6.11655,-3.54366 -6.27751,-6.91014 H 123.04607 l -5.55319,6.11281 v 23.1224 l 6.15679,6.77725 2.93756,-6.77725 -3.86308,-4.2524 v -16.30085 l 2.89731,-2.83492 H 229.9247 Z"
id="path3640"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path3632"
d="m 828.9375,369.5 -4.28125,4.28125 V 389.5 l 3.75,3.75 h 19.8125 v 15.1875 L 717.15625,541.28125 V 393.4375 h 21.78125 l 4.46875,-4.46875 V 373.0625 l -4.125,-3.1875 h -114.625 l -3.75,3.75 v 16.25 l 3.8125,3.8125 h 19.9375 v 272.25 l 3.75,3.75 H 671.0625 L 945.71875,386.28125 v -12.5 L 941.4375,369.5 Z"
transform="matrix(0.90138601,0,0,0.99222542,-437.42287,-185.30615)"
inkscape:connector-curvature="0" />
<path
style="fill:#fefefe;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 143.48158,204.87424 v 270.62073 l 3.18688,4.0092 -2.49916,5.24301 -7.06148,-7.74876 v -265.1081 z"
id="path3646"
inkscape:connector-curvature="0" />
<path
style="fill:#808080;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 125.82451,204.87424 -1.82108,6.51494 h 13.2028 l 7.2843,-6.51494 z"
id="path3644"
inkscape:connector-curvature="0" />
<path
style="fill:#fefefe;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 307.18636,212.19144 2.89731,-6.55577 -4.18501,-4.2524 v -14.52901 l 4.82886,-5.31551 H 411.4896 l 3.86308,5.66987 5.4727,-4.2524 -5.63366,-6.20141 H 306.86443 l -5.39221,5.93564 v 23.29957 l 5.59342,5.80276 m -87.54309,111.87785 -10.52288,28.10566 118.7898,-131.1155 v -15.59211 z"
id="path3638"
inkscape:connector-curvature="0" />
<path
style="fill:#808080;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 232.25896,185.83056 5.2356,-3.75862 v 22.8023 l -6.03231,6.64023 h -11.72317 v 112.38277 l -10.69882,27.81381 V 204.87424 h 19.57656 l 3.64214,-3.25747 z"
id="path3642"
inkscape:connector-curvature="0" />
<path
style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path3622"
d="m 828.9375,369.5 -4.28125,4.28125 V 389.5 l 3.75,3.75 h 19.8125 v 15.1875 L 717.15625,541.28125 V 393.4375 h 21.78125 l 4.46875,-4.46875 V 373.0625 l -4.125,-3.1875 h -114.625 l -3.75,3.75 v 16.25 l 3.8125,3.8125 h 19.9375 v 272.25 l 3.75,3.75 H 671.0625 L 945.71875,386.28125 v -12.5 L 941.4375,369.5 Z"
transform="matrix(0.90138601,0,0,0.99222542,-437.42287,-185.30615)"
inkscape:connector-curvature="0" />
<path
style="fill:#808080;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 415.35268,185.9329 5.49849,-3.49448 v 21.92152 L 171.46006,484.88124 H 144.9826 l 2.52966,-5.5331 h 20.28119 L 415.03076,198.33573 Z"
id="path3636"
inkscape:connector-curvature="0" />
<path
style="fill:#808080;fill-opacity:1;stroke:#000000;stroke-width:0.94571567px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 327.29631,205.25009 -5.57703,6.38966 h -14.56861 l 3.41452,-6.38966 c 0.11382,0 16.73112,0 16.73112,0 z"
id="path3652"
inkscape:connector-curvature="0" />
<g
id="g3673"
transform="matrix(0.90138601,0,0,0.99222542,-92.530288,-192.23791)">
<path
d="m 399.78125,560 a 1.2330102,1.2330102 0 0 0 -0.5625,0.28125 l -5.3125,4.5625 A 1.2330102,1.2330102 0 0 0 393.5625,565.375 L 388.25,580.25 a 1.2330102,1.2330102 0 0 0 0.28125,1.28125 l 4.0625,4.0625 a 1.2330102,1.2330102 0 0 0 0.875,0.34375 H 409.875 a 1.2330102,1.2330102 0 0 0 0.875,-0.34375 l 4.28125,-4.3125 a 1.2330102,1.2330102 0 0 0 0.3125,-0.53125 l 4.5625,-15.65625 a 1.2330102,1.2330102 0 0 0 -0.3125,-1.21875 l -3.53125,-3.53125 A 1.2330102,1.2330102 0 0 0 415.1875,560 h -15.15625 a 1.2330102,1.2330102 0 0 0 -0.25,0 z m -30.0625,41.9375 a 1.2330102,1.2330102 0 0 0 -0.9375,0.90625 l -2.03125,8.0625 a 1.2330102,1.2330102 0 0 0 1.1875,1.53125 h 9.65625 l -23.9375,68.34375 a 1.2330102,1.2330102 0 0 0 1.15625,1.625 h 34.84375 a 1.2330102,1.2330102 0 0 0 1.1875,-0.84375 l 2.28125,-7.34375 a 1.2330102,1.2330102 0 0 0 -1.1875,-1.59375 h -7.875 L 407.75,603.5625 a 1.2330102,1.2330102 0 0 0 -1.15625,-1.625 h -36.625 a 1.2330102,1.2330102 0 0 0 -0.25,0 z m 110.875,0.25 a 1.2330102,1.2330102 0 0 0 -0.6875,0.40625 l -7.25,8.1875 H 461.125 l -7.6875,-7.96875 a 1.2330102,1.2330102 0 0 0 -0.875,-0.375 H 425.03125 A 1.2330102,1.2330102 0 0 0 423.875,603.25 l -2.53125,7.5625 a 1.2330102,1.2330102 0 0 0 1.15625,1.625 h 7.375 l -22.9375,67.59375 a 1.2330102,1.2330102 0 0 0 1.15625,1.625 h 29.3125 a 1.2330102,1.2330102 0 0 0 1.15625,-0.8125 l 2.25,-6.59375 a 1.2330102,1.2330102 0 0 0 -1.15625,-1.625 h -5.125 l 14.625,-46.03125 H 475.625 l -16.6875,53.46875 a 1.2330102,1.2330102 0 0 0 1.1875,1.59375 h 28.28125 a 1.2330102,1.2330102 0 0 0 1.125,-0.75 l 2.53125,-6.0625 a 1.2330102,1.2330102 0 0 0 -1.125,-1.6875 h -5.125 l 14.875,-46.8125 h 25.1875 l -16.9375,53.71875 a 1.2330102,1.2330102 0 0 0 1.1875,1.59375 h 31.0625 a 1.2330102,1.2330102 0 0 0 1.15625,-0.78125 l 2.53125,-6.59375 a 1.2330102,1.2330102 0 0 0 -1.15625,-1.65625 h -6.15625 l 18.71875,-60.78125 a 1.2330102,1.2330102 0 0 0 -0.1875,-1.125 l -5.8125,-7.8125 a 1.2330102,1.2330102 0 0 0 -1,-0.46875 H 527.0625 a 1.2330102,1.2330102 0 0 0 -0.90625,0.375 l -7,7.6875 h -12.25 l -7.25,-7.9375 a 1.2330102,1.2330102 0 0 0 -0.90625,-0.375 h -17.90625 a 1.2330102,1.2330102 0 0 0 -0.25,0 z"
id="path3671"
style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="path3665"
d="m 400.03125,561.21875 -5.3125,4.5625 -5.3125,14.875 4.0625,4.0625 H 409.875 l 4.28125,-4.3125 4.5625,-15.65625 -3.53125,-3.53125 z m -30.0625,41.9375 -2.03125,8.0625 h 11.375 l -24.5,69.96875 h 34.84375 l 2.28125,-7.34375 h -9.59375 l 24.25,-70.6875 z m 110.875,0.25 L 473.25,612 h -12.625 l -8.0625,-8.34375 h -27.53125 l -2.53125,7.5625 h 9.09375 l -23.5,69.21875 h 29.3125 l 2.25,-6.59375 h -6.8125 L 448.25,625.375 h 29.0625 l -17.1875,55.0625 h 28.28125 l 2.53125,-6.0625 h -6.8125 l 15.65625,-49.25 h 27.78125 l -17.4375,55.3125 h 31.0625 l 2.53125,-6.59375 H 535.875 l 19.21875,-62.375 -5.8125,-7.8125 H 527.0625 l -7.34375,8.0625 h -13.375 l -7.59375,-8.3125 z"
inkscape:connector-curvature="0" />
</g>
</g>
</g>
<path
sodipodi:nodetypes="csccscc"
inkscape:connector-curvature="0"
id="path4030"
d="m -521.13579,1885.039 c -109.72778,14.6045 -194.3908,109.3291 -194.3908,224 0,114.6706 84.66302,209.3954 194.3908,224 v -65.7392 c -74.0132,-14.0046 -130.02298,-79.5383 -130.02298,-158.2608 0,-78.7226 56.00978,-144.2566 130.02298,-158.2609 z"
style="fill:#d0343f;fill-opacity:1;stroke:none;stroke-width:2.58588266" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,6 @@
VIM = nvim
.PHONY: check
check:
@VADER_OUTPUT_FILE=/dev/stdout $(VIM) --headless -c 'Vader! test/*.vader'

View File

@ -0,0 +1,106 @@
" License: The MIT License (MIT) {{{
" Copyright (c) 2019 HiPhish
"
" Permission is hereby granted, free of charge, to any person obtaining a
" copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to permit
" persons to whom the Software is furnished to do so, subject to the
" following conditions:
"
" The above copyright notice and this permission notice shall be included
" in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
" NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
" USE OR OTHER DEALINGS IN THE SOFTWARE.
" }}}
" GNU Guile syntax highlighting for extensions to Scheme
scriptencoding utf-8
" =============================================================================
" Multi-line comments, used for the shebang
syntax region guileComment start='\v<#!' end='\v!#'
" Keywords
syntax match guileKeyword '\v<#:[^ ()]+>'
" ===[ Special keywords ]======================================================
" Special keywords
syntax keyword guileSyntax define*
syntax keyword guileSyntax define-public
syntax keyword guileSyntax define-module
syntax keyword guileSyntax define-accessor
syntax keyword guileSyntax define-class
syntax keyword guileSyntax define-enumeration
syntax keyword guileSyntax define-inlinable
syntax keyword guileSyntax define-syntax-parameter
syntax keyword guileSyntax λ
syntax keyword guileSyntax lambda*
syntax keyword guileSyntax use-modules
syntax keyword guileSyntax call-with-input-file
syntax keyword guileSyntax call-with-input-string
syntax keyword guileSyntax call-with-output-file
syntax keyword guileSyntax call-with-output-string
syntax keyword guileSyntax call-with-prompt
syntax keyword guileSyntax call-with-trace
syntax keyword guileSyntax eval-when
syntax keyword guileSyntax syntax-parameterize
syntax keyword guileSyntax with-error-to-file
syntax keyword guileSyntax with-error-to-port
syntax keyword guileSyntax with-error-to-string
syntax keyword guileSyntax with-fluid*
syntax keyword guileSyntax with-fluids
syntax keyword guileSyntax with-fluids*
syntax keyword guileSyntax with-input-from-port
syntax keyword guileSyntax with-input-from-string
syntax keyword guileSyntax with-output-to-port
syntax keyword guileSyntax with-output-to-string
" Macros
syntax keyword guileSyntaxSyntax define-syntax-rule
" ===[ Literals ]==============================================================
" Boolean literals
syntax keyword guileBoolean #true
syntax keyword guileBoolean #false
" Unspecified literal (e.g. the return value of '(if #f #f)')
syntax match guileConstant '\v<#\<unspecified\>>'
" Byte vector literal
syntax match guileQuote '\v<\zs#vu8\ze\('
" Number literals
syntax match guileNumber '\v<#[bB][+-]?[0-1]+>'
syntax match guileNumber '\v<#[oO][+-]?[0-7]+>'
syntax match guileNumber '\v<#[dD][+-]?\d+>'
syntax match guileNumber '\v<#[xX][+-]?[0-9a-fA-F]+>'
syntax match guileNumber '\v<#[eE][+-]?(\d+\.\d*|\d*\.\d+|\d+)>' " Exact
syntax match guileNumber '\v<(\+|-)(inf|nan)\.0>' " NaN and infinity
" =============================================================================
highlight link guileComment schemeComment
highlight link guileQuote schemeQuote
highlight link guileSyntax schemeSyntax
highlight link guileSyntaxSyntax schemeSyntaxSyntax
highlight link guileBoolean schemeBoolean
highlight link guileConstant schemeConstant
highlight link guileNumber schemeNumber
highlight link guileKeyword Type

View File

@ -0,0 +1,25 @@
# Test whether Guile is being detected
Given (Detect by shebang):
#!/usr/local/bin/guile -s
!#
Execute:
Assert guile#detect()
Given (Detect by define-module):
(define-module (foo bar))
Execute:
Assert guile#detect()
Given (Detect by use-modules):
(use-modules (foo bar))
Execute:
Assert guile#detect()
-----------------------------------------------------------------------------
# Test whether the file type is adjusted when a Guile file is edited
Execute (File type adjustment):
edit test/nonsense.scm
Then:
AssertEqual 'scheme.guile', &ft
bwipeout!

View File

@ -0,0 +1,7 @@
#!/usr/local/bin/guile -s
!#
;;; This is a nonsense file, meant to test whether the file type is adjusted
;;; properly. The Guile detection itself is tested separately.
(display "Hello from Guile!")
(newline)

View File

@ -0,0 +1,119 @@
# Note: For simplicity we will not check the syntax highlighting of fixed
# keywords like 'define-public', only the highlighting of patterns
Given scheme.guile (Multi-line comment):
#!/usr/local/bin/guile -s
!#
#! This is a
multi-line comment !#
Execute:
for i in range(1, 25)
AssertEqual 'guileComment', SyntaxAt(1, i)
endfor
AssertEqual 'guileComment', SyntaxAt(2, 1)
AssertEqual 'guileComment', SyntaxAt(2, 2)
for i in range(1, 12)
AssertEqual 'guileComment', SyntaxAt(3, i)
endfor
for i in range(1, 21)
AssertEqual 'guileComment', SyntaxAt(4, i)
endfor
-----------------------------------------------------------------------------
Given scheme.guile (keywords):
#:keyword
#:key-word
Execute:
for i in range(1, 9)
AssertEqual 'guileKeyword', SyntaxAt(1, i)
endfor
for i in range(1, 10)
AssertEqual 'guileKeyword', SyntaxAt(2, i)
endfor
-----------------------------------------------------------------------------
Given scheme.guile (Boolean literals):
#true
#false
Execute:
for i in range(1, 5)
AssertEqual 'guileBoolean', SyntaxAt(1, i)
endfor
for i in range(1, 6)
AssertEqual 'guileBoolean', SyntaxAt(2, i)
endfor
-----------------------------------------------------------------------------
Given scheme.guile (Unspecified object representation):
#<unspecified>
Execute:
for i in range(1, 14)
AssertEqual 'guileConstant', SyntaxAt(1, i)
endfor
-----------------------------------------------------------------------------
Given scheme.guile (Bytevector literal):
#vu8(1 2 3 4)
Execute:
for i in range(1, 4)
AssertEqual 'guileQuote', SyntaxAt(1, i)
endfor
-----------------------------------------------------------------------------
Given scheme.guile (Integer number literals):
#b0101 #b+0101 #b-0101 #B0101 #B+0101 #B-0101
#o0237 #o+0237 #o-0237 #O0237 #O+0237 #O-0237
#d0239 #d+0239 #d-0239 #D0239 #D+0239 #D-0239
#x03AF #x+03AF #x-03AF #X03AF #X+03AF #X-03AF
#x03af #x+03af #x-03af #X03af #X+03af #X-03af
Execute:
for i in range(1, 5)
for j in range(1, 6)
for k in [0, 7, 15, 23, 30, 38]
AssertEqual 'guileNumber', SyntaxAt(i, k + j)
endfor
endfor
endfor
-----------------------------------------------------------------------------
Given scheme.guile (Exact decimal number literls):
#e012345 #e+01234 #e-01234 #E012345 #E+01234 #E-01234
#e.12345 #e+.1234 #e-.1234 #E.12345 #E+.1234 #E-.1234
#e0.1234 #e+0.123 #e-0.123 #E0.1234 #E+0.123 #E-0.123
Execute:
for line in [1, 2]
for offset in range(0, 5)
for column in range(1, 8)
AssertEqual 'guileNumber', SyntaxAt(line, offset * 9 + column)
endfor
endfor
endfor
-----------------------------------------------------------------------------
Given scheme.guile (Infinity and NaN literals):
+inf.0 -inf.0 +nan.0 -nan.0
Execute:
for offset in range(0, 3)
for i in range(1, 6)
AssertEqual 'guileNumber', SyntaxAt(1, offset * 7 + i)
endfor
endfor
-----------------------------------------------------------------------------
Given scheme.guile (Syntax-rule macro):
(define-syntax-rule (first-of expr expr* ...)
expr)
Execute:
for i in range(2, 19)
AssertEqual 'guileSyntaxSyntax', SyntaxAt(1, i)
endfor