]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/scheme.js
1 /*! `scheme` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
8 Description: Scheme is a programming language in the Lisp family.
9 (keywords based on http://community.schemewiki.org/?scheme-keywords)
10 Author: JP Verkamp <me@jverkamp.com>
11 Contributors: Ivan Sagalaev <maniac@softwaremaniacs.org>
13 Website: http://community.schemewiki.org/?what-is-scheme
17 function scheme(hljs
) {
18 const SCHEME_IDENT_RE
= '[^\\(\\)\\[\\]\\{\\}",\'`;#|\\\\\\s]+';
19 const SCHEME_SIMPLE_NUMBER_RE
= '(-|\\+)?\\d+([./]\\d+)?';
20 const SCHEME_COMPLEX_NUMBER_RE
= SCHEME_SIMPLE_NUMBER_RE
+ '[+\\-]' + SCHEME_SIMPLE_NUMBER_RE
+ 'i';
22 $pattern: SCHEME_IDENT_RE
,
24 'case-lambda call/cc class define-class exit-handler field import '
25 + 'inherit init-field interface let*-values let-values let/ec mixin '
26 + 'opt-lambda override protect provide public rename require '
27 + 'require-for-syntax syntax syntax-case syntax-error unit/sig unless '
28 + 'when with-syntax and begin call-with-current-continuation '
29 + 'call-with-input-file call-with-output-file case cond define '
30 + 'define-syntax delay do dynamic-wind else for-each if lambda let let* '
31 + 'let-syntax letrec letrec-syntax map or syntax-rules \' * + , ,@ - ... / '
32 + '; < <= = => > >= ` abs acos angle append apply asin assoc assq assv atan '
33 + 'boolean? caar cadr call-with-input-file call-with-output-file '
34 + 'call-with-values car cdddar cddddr cdr ceiling char->integer '
35 + 'char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? '
36 + 'char-downcase char-lower-case? char-numeric? char-ready? char-upcase '
37 + 'char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? '
38 + 'char? close-input-port close-output-port complex? cons cos '
39 + 'current-input-port current-output-port denominator display eof-object? '
40 + 'eq? equal? eqv? eval even? exact->inexact exact? exp expt floor '
41 + 'force gcd imag-part inexact->exact inexact? input-port? integer->char '
42 + 'integer? interaction-environment lcm length list list->string '
43 + 'list->vector list-ref list-tail list? load log magnitude make-polar '
44 + 'make-rectangular make-string make-vector max member memq memv min '
45 + 'modulo negative? newline not null-environment null? number->string '
46 + 'number? numerator odd? open-input-file open-output-file output-port? '
47 + 'pair? peek-char port? positive? procedure? quasiquote quote quotient '
48 + 'rational? rationalize read read-char real-part real? remainder reverse '
49 + 'round scheme-report-environment set! set-car! set-cdr! sin sqrt string '
50 + 'string->list string->number string->symbol string-append string-ci<=? '
51 + 'string-ci<? string-ci=? string-ci>=? string-ci>? string-copy '
52 + 'string-fill! string-length string-ref string-set! string<=? string<? '
53 + 'string=? string>=? string>? string? substring symbol->string symbol? '
54 + 'tan transcript-off transcript-on truncate values vector '
55 + 'vector->list vector-fill! vector-length vector-ref vector-set! '
56 + 'with-input-from-file with-output-to-file write write-char zero?'
61 begin: '(#t|#f|#\\\\' + SCHEME_IDENT_RE
+ '|#\\\\.)'
68 begin: SCHEME_SIMPLE_NUMBER_RE
,
72 begin: SCHEME_COMPLEX_NUMBER_RE
,
75 { begin: '#b[0-1]+(/[0-1]+)?' },
76 { begin: '#o[0-7]+(/[0-7]+)?' },
77 { begin: '#x[0-9a-f]+(/[0-9a-f]+)?' }
81 const STRING
= hljs
.QUOTE_STRING_MODE
;
83 const COMMENT_MODES
= [
89 hljs
.COMMENT('#\\|', '\\|#')
93 begin: SCHEME_IDENT_RE
,
97 const QUOTED_IDENT
= {
99 begin: '\'' + SCHEME_IDENT_RE
103 endsWithParent: true,
107 const QUOTED_LIST
= {
131 begin: SCHEME_IDENT_RE,
137 endsWithParent: true,
184 ].concat(COMMENT_MODES);
197 ].concat(COMMENT_MODES)
205 hljs.registerLanguage('scheme', hljsGrammar);