mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 22:59:29 +01:00
86e2789960
* update github.com/PuerkitoBio/goquery * update github.com/alecthomas/chroma * update github.com/blevesearch/bleve/v2 * update github.com/caddyserver/certmagic * update github.com/go-enry/go-enry/v2 * update github.com/go-git/go-billy/v5 * update github.com/go-git/go-git/v5 * update github.com/go-redis/redis/v8 * update github.com/go-testfixtures/testfixtures/v3 * update github.com/jaytaylor/html2text * update github.com/json-iterator/go * update github.com/klauspost/compress * update github.com/markbates/goth * update github.com/mattn/go-isatty * update github.com/mholt/archiver/v3 * update github.com/microcosm-cc/bluemonday * update github.com/minio/minio-go/v7 * update github.com/prometheus/client_golang * update github.com/unrolled/render * update github.com/xanzy/go-gitlab * update github.com/yuin/goldmark * update github.com/yuin/goldmark-highlighting Co-authored-by: techknowlogick <techknowlogick@gitea.io>
57 lines
4 KiB
Go
Vendored
57 lines
4 KiB
Go
Vendored
package s
|
|
|
|
import (
|
|
. "github.com/alecthomas/chroma" // nolint
|
|
"github.com/alecthomas/chroma/lexers/internal"
|
|
)
|
|
|
|
// nolint
|
|
|
|
// Scheme lexer.
|
|
var SchemeLang = internal.Register(MustNewLazyLexer(
|
|
&Config{
|
|
Name: "Scheme",
|
|
Aliases: []string{"scheme", "scm"},
|
|
Filenames: []string{"*.scm", "*.ss"},
|
|
MimeTypes: []string{"text/x-scheme", "application/x-scheme"},
|
|
},
|
|
schemeLangRules,
|
|
))
|
|
|
|
func schemeLangRules() Rules {
|
|
return Rules{
|
|
"root": {
|
|
{`;.*$`, CommentSingle, nil},
|
|
{`#\|`, CommentMultiline, Push("multiline-comment")},
|
|
{`#;\s*\(`, Comment, Push("commented-form")},
|
|
{`#!r6rs`, Comment, nil},
|
|
{`\s+`, Text, nil},
|
|
{`-?\d+\.\d+`, LiteralNumberFloat, nil},
|
|
{`-?\d+`, LiteralNumberInteger, nil},
|
|
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
|
{`'[\w!$%&*+,/:<=>?@^~|-]+`, LiteralStringSymbol, nil},
|
|
{`#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)`, LiteralStringChar, nil},
|
|
{`(#t|#f)`, NameConstant, nil},
|
|
{"('|#|`|,@|,|\\.)", Operator, nil},
|
|
{`(lambda |define |if |else |cond |and |or |case |let |let\* |letrec |begin |do |delay |set\! |\=\> |quote |quasiquote |unquote |unquote\-splicing |define\-syntax |let\-syntax |letrec\-syntax |syntax\-rules )`, Keyword, nil},
|
|
{`(?<='\()[\w!$%&*+,/:<=>?@^~|-]+`, NameVariable, nil},
|
|
{`(?<=#\()[\w!$%&*+,/:<=>?@^~|-]+`, NameVariable, nil},
|
|
{`(?<=\()(\* |\+ |\- |\/ |\< |\<\= |\= |\> |\>\= |abs |acos |angle |append |apply |asin |assoc |assq |assv |atan |boolean\? |caaaar |caaadr |caaar |caadar |caaddr |caadr |caar |cadaar |cadadr |cadar |caddar |cadddr |caddr |cadr |call\-with\-current\-continuation |call\-with\-input\-file |call\-with\-output\-file |call\-with\-values |call\/cc |car |cdaaar |cdaadr |cdaar |cdadar |cdaddr |cdadr |cdar |cddaar |cddadr |cddar |cdddar |cddddr |cdddr |cddr |cdr |ceiling |char\-\>integer |char\-alphabetic\? |char\-ci\<\=\? |char\-ci\<\? |char\-ci\=\? |char\-ci\>\=\? |char\-ci\>\? |char\-downcase |char\-lower\-case\? |char\-numeric\? |char\-ready\? |char\-upcase |char\-upper\-case\? |char\-whitespace\? |char\<\=\? |char\<\? |char\=\? |char\>\=\? |char\>\? |char\? |close\-input\-port |close\-output\-port |complex\? |cons |cos |current\-input\-port |current\-output\-port |denominator |display |dynamic\-wind |eof\-object\? |eq\? |equal\? |eqv\? |eval |even\? |exact\-\>inexact |exact\? |exp |expt |floor |for\-each |force |gcd |imag\-part |inexact\-\>exact |inexact\? |input\-port\? |integer\-\>char |integer\? |interaction\-environment |lcm |length |list |list\-\>string |list\-\>vector |list\-ref |list\-tail |list\? |load |log |magnitude |make\-polar |make\-rectangular |make\-string |make\-vector |map |max |member |memq |memv |min |modulo |negative\? |newline |not |null\-environment |null\? |number\-\>string |number\? |numerator |odd\? |open\-input\-file |open\-output\-file |output\-port\? |pair\? |peek\-char |port\? |positive\? |procedure\? |quotient |rational\? |rationalize |read |read\-char |real\-part |real\? |remainder |reverse |round |scheme\-report\-environment |set\-car\! |set\-cdr\! |sin |sqrt |string |string\-\>list |string\-\>number |string\-\>symbol |string\-append |string\-ci\<\=\? |string\-ci\<\? |string\-ci\=\? |string\-ci\>\=\? |string\-ci\>\? |string\-copy |string\-fill\! |string\-length |string\-ref |string\-set\! |string\<\=\? |string\<\? |string\=\? |string\>\=\? |string\>\? |string\? |substring |symbol\-\>string |symbol\? |tan |transcript\-off |transcript\-on |truncate |values |vector |vector\-\>list |vector\-fill\! |vector\-length |vector\-ref |vector\-set\! |vector\? |with\-input\-from\-file |with\-output\-to\-file |write |write\-char |zero\? )`, NameBuiltin, nil},
|
|
{`(?<=\()[\w!$%&*+,/:<=>?@^~|-]+`, NameFunction, nil},
|
|
{`[\w!$%&*+,/:<=>?@^~|-]+`, NameVariable, nil},
|
|
{`(\(|\))`, Punctuation, nil},
|
|
{`(\[|\])`, Punctuation, nil},
|
|
},
|
|
"multiline-comment": {
|
|
{`#\|`, CommentMultiline, Push()},
|
|
{`\|#`, CommentMultiline, Pop(1)},
|
|
{`[^|#]+`, CommentMultiline, nil},
|
|
{`[|#]`, CommentMultiline, nil},
|
|
},
|
|
"commented-form": {
|
|
{`\(`, Comment, Push()},
|
|
{`\)`, Comment, Pop(1)},
|
|
{`[^()]+`, Comment, nil},
|
|
},
|
|
}
|
|
}
|