Warning, /frameworks/syntax-highlighting/autotests/input/highlight.scheme is written in an unsupported language. File is not indexed.

0001 ; This is a test file to test kates scheme highlighting
0002 ; This is a comment
0003 
0004 ; Brackets colors
0005 ((((((((((((( )))))))))))))
0006 
0007 ;; Another comment, usually used.
0008 ;BEGIN region marker
0009 ;; a vektor
0010 #(1 2 3 4 5)
0011 ['a 'b 'c]
0012 ;END region marker
0013 ;; this represents integer 28 (FIXME: does not work perfectly atm!)
0014 28 028 #e28 #i28       ;; Normal, normal, exact, inexact
0015 #b11100 #o34 #d28 #x1c ;; Bin, oct, dec, hex
0016 #oe34 #eo34            ;; combined.
0017 #o#e34 #e#o34          ;; combined.
0018 ;; inf
0019 #i+inf.0 3+inf.0
0020 
0021 ;; symbols
0022 &symbol-42
0023 symbol-42;comment
0024 
0025 ;; char.
0026 (#\y #\space) ;; list: `y' space.
0027 (#\  #\\ #\)) ;; list of spaces, backslash and`)'.
0028 #\newline     ;; a newline-char
0029 #\NewLine     ;; another one :)
0030 #\pager       ;; bad char
0031 
0032 "Hello, world" ;; a string
0033 
0034 "hoho, what do you
0035 want to do  ;; this is NO comment
0036 with that?"
0037 
0038 ;; R5RS definiert diese beiden.
0039 "Das ist \"in Anführungszeichen\" und mit \\ Backslash."
0040 
0041 "hexadecimal char \x1aF;."
0042 
0043 ;; Kawa string templates
0044 &{Hello &[name]!} 'no-string
0045 &{This has a {braced} section.} 'no-string
0046 &{  & < > " '} 'no-string
0047 ; Multiline string literals
0048 (string-capitalize &{one two three
0049 uno dos tres
0050 })
0051 (write (string-capitalize &{
0052      &|one two three
0053      &|uno dos tres
0054 }) out)
0055 &{abc&- #|comment|#
0056   def} 'no-string
0057 &{&#|line 1|#one two
0058   &#|line 2|# three
0059   &#|line 3|#uno dos tres
0060 } 'no-string
0061 ; Embedded expressions
0062 &{Hello &[(string-capitalize name)]!} 'no-string
0063 &{Hello &(string-capitalize name)!} 'no-string
0064 ; formatting
0065 &{&~{&[arr]&~^_&~}} 'no-string
0066 &{&~{&~a[arr]&~^_&~}} 'no-string
0067 
0068 ;; Kawa XML literals
0069 #<p>The result is <b>final</b>!</p> 'no-xml
0070 #<em>The result is &{result}.</em> 'no-xml
0071 #<p>This is <(if be-bold 'strong 'em)>important</>!</p> 'no-xml
0072 #<p>This is <{(if be-bold 'strong 'em)}>important</>!</p> 'no-xml
0073 #<p>Special characters <![CDATA[< > & ' "]]> here.</p> 'no-xml
0074 #<p>Special characters &lt; &gt; &amp; &quot; &apos; here.</p> 'no-xml
0075 #<gnu:b xmlns:gnu="http://gnu.org/"/> 'no-xml
0076 #<chapter><?dbhtml filename="intro.html" ?>
0077 <title>Introduction</title>
0078 ...
0079 </chapter> 'no-xml
0080 
0081 
0082 ;; Kawa Regular expression
0083 #/a\.c/
0084 #/a/i
0085 #/a/im
0086 
0087 
0088 (let ((x (+ 1 2)) (y "blah")) ;; `let' highlighting.
0089   (and (number? x)            ;; `and' highlighting.
0090        (string? y)))
0091 
0092 (let* ((x 2) (y (+ x 1))) ;; `let*' too.
0093   (or (negative? x)       ;; `or' anyways.
0094       (negative? y)))
0095 
0096 (do ((vec (make-vector 5)) ;; `do' you may guess!
0097      (i 0 (+ i 1)))
0098     ((= i 5) vec)
0099   (vector-set! vec i i))
0100 
0101 (quasiquote ((+ 1 2) (unquote (+ 1 2))))
0102 ;; same as: `((+ 1 2) ,(+ 1 2))
0103 
0104 ;; see above.
0105 (quasiquote ((+ 1 2) (unquote-splicing (list 1 2 3))))
0106 ;; same as: `((+ 1 2) ,@(+ 1 2))
0107 
0108 ;; not necessary.
0109 (quote ())
0110 
0111 (cond ((string? x) (string->symbol x)) ;; `cond' highlighting.
0112       ((symbol? x) => (lambda (x) x))  ;; `=>' highlighting.
0113       (else ;; `else' highlighting.
0114        (error "Blah")))
0115 
0116 (case x ;; `case' highlighting.
0117   ((#t) 'true) ((#f) 'false)
0118   ((()) 'null)
0119   ((0) 'zero))
0120 
0121 ;; highlight `let-syntax' and `syntax-rules' .
0122 (let-syntax ((when (syntax-rules ()
0123                      ((when test stmt1 stmt2 ...)
0124                       ;; hl `begin' .
0125                       (if test (begin stmt1 stmt2 ...))))))
0126   (let ((if #t)) ;; here`if' is actually no keyword.
0127     (when if (set! if 'now)) ;; nor here.
0128     if))
0129 
0130 (letrec-syntax ...) ;; hl `letrec-syntax'.
0131 
0132 (define-syntax when
0133   (syntax-rules ()
0134     ((when test stmt1 stmt2 ...)
0135      (if test (begin stmt1 stmt2 ...))))))
0136 
0137 ;; variable definitions.
0138 (define natural-numbers ;; hl `define' and the var name
0139   ;; endless stream of all natual numbers.
0140   (letrec ((next-cell    ;; hl `letrec'.
0141             (lambda (x)  ;; hl `lambda'.
0142               ;; hl `delay' .
0143               (cons x (delay (next-cell (+ x 1)))))))
0144     (next-cell 0)))
0145 
0146 ;; a procedure with unusual but allowed name.
0147 (define 1+
0148   (lambda (x)
0149     (+ x 1)))
0150 
0151 ;; a predicate
0152 (define between?
0153   (lambda (x y z)
0154     (if (and (>= x y) (<= x z))
0155         #t ;; True
0156       #f))) ;; False.
0157 
0158 ;; imperative procedure
0159 (define set-something!
0160   (lambda (required-argument another-one . all-remaining-args)
0161     (set-car! another-one (lambda all-args
0162                             (set-cdr! required-argument
0163                                       (append all-remaining-args
0164                                               all-args))))))
0165 
0166 (define compose
0167   (lambda (f g)
0168     (lambda (x)
0169       (f (g x)))))
0170 
0171 ;; syntactical sugar for procedure-definitions.
0172 (define (compose f g)
0173   (lambda (x)
0174     (f (g x))))
0175 
0176 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
0177 ;; NOW: Guile extensions ;;
0178 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
0179 
0180 ;; procedure-generator.
0181 (define ((compose f g) x)
0182   (f (g x)))
0183 
0184 ;; scheme doesn't say, which chars may be in variables...
0185 ;; At least: Guile accepts umlauts
0186 (define-private (timetr??? sprache) ;; hl `define-private'.
0187   (list-dialekt? sprache))
0188 
0189 (define-public x #t)  ;; hl `define-public'.
0190 (define-module (foo bar)) ;; hl `define-module'.
0191 (define-macro (neither . exprs) ;; hl `define-macro'.
0192   `(and ,@(map (lambda (x) `(not ,x)) exprs)))
0193 
0194 (defmacro neither exprs ;; `defmacro' as well.
0195   `(and ,@(map (lambda (x) `(not ,x)) exprs)))
0196 
0197 ;; hl, but I really don't know what this is supposed to do :-)
0198 (define-syntax-macro ...)
0199 
0200 ;; hl GOOPS-`defines'
0201 (define-method (foo bar (baz <vector>) qux) ...)
0202 (define-class <foo> ...)
0203 (define-generic foo)
0204 (define-accessor bar)
0205 
0206 ;; Keywords!
0207 (blah #:foo 33 #:bar 44)
0208 
0209 ;; another convention for symbols:
0210 #{foo}#
0211 
0212 #{a
0213 few
0214 lines}#
0215 
0216 #{4711}#
0217 
0218 ;; more chars.
0219 #\nul #\nl #\esc #\bs #\bel #\syn #\ack #\sp ;; etc, utc, itc, oops (this is boring)
0220 
0221 #| R6RS / SRFI-30 block comment
0222 supports #| nested block |# comments |#
0223 'now-no-comment-anymore
0224 
0225 #!
0226  guile block-comment.
0227 !#
0228 
0229 ;; now, a bit hairy:
0230 #! comment !#
0231 still comment!!!
0232 !#
0233 'now-no-comment-anymore
0234 
0235 ;; more precise:
0236 #! comment !#
0237 still comment
0238 !# still comment!
0239 !#
0240 'now-no-comment-anymore
0241 
0242 ;; Datum comment
0243 #;(1 2 3) 'now-no-comment-anymore
0244 #;1 'now-no-comment-anymore
0245 #;#o12 'now-no-comment-anymore
0246 #;"bla bla\"" 'now-no-comment-anymore
0247 #;[1 2 3] 'now-no-comment-anymore
0248 #;[1 [2 (3 (4))]] 'now-no-comment-anymore
0249 #;(1 (2 [3 [4]])) 'now-no-comment-anymore
0250 #;#/reg/im 'now-no-comment-anymore
0251 #;#<p>The result is <b>final</b>!</p> 'now-no-comment-anymore
0252 #;#<em>The result is &{result}.</em> 'now-no-comment-anymore
0253 #;#<p>This is <(if be-bold 'strong 'em)>important</>!</p> 'now-no-comment-anymore
0254 #;#<p>This is <{(if be-bold 'strong 'em)}>important</>!</p> 'now-no-comment-anymore
0255 #;#<p>Specal characters <![CDATA[< > & ' "]]> here.</p> 'now-no-comment-anymore
0256 #;#<p>Specal characters &lt; &gt; &amp; &quot; &apos; here.</p> 'now-no-comment-anymore
0257 #;#<gnu:b xmlns:gnu="http://gnu.org/"/> 'now-no-comment-anymore
0258 #;#<chapter><?dbhtml filename="intro.html" ?>
0259 <title>Introduction</title>
0260 ...
0261 </chapter> 'now-no-comment-anymore
0262 #;#&{Hello &[name]!} 'now-no-comment-anymore
0263 #;&{This has a {braced} section.} 'now-no-comment-anymore
0264 #;&{&#27;&#x1B; &amp; &lt; &gt; &quot; &apos;} 'now-no-comment-anymore
0265 #;(string-capitalize &{one two three
0266 uno dos tres
0267 }) 'now-no-comment-anymore
0268 #;(write (string-capitalize &{
0269      &|one two three
0270      &|uno dos tres
0271 }) out) 'now-no-comment-anymore
0272 #;&{abc&-
0273   def} 'now-no-comment-anymore
0274 #;&{&#|line 1|#one two
0275   &#|line 2|# three
0276   &#|line 3|#uno dos tres
0277 } 'now-no-comment-anymore
0278 #;&{Hello &[(string-capitalize name)]!} 'now-no-comment-anymore
0279 #;&{Hello &(string-capitalize name)!} 'now-no-comment-anymore
0280 #;&{&~{&[arr]&~^_&~}} 'now-no-comment-anymore
0281 #;&{&~{&~a[arr]&~^_&~}} 'now-no-comment-anymore
0282 #;(
0283 1
0284 2
0285 3) 'now-no-comment-anymore
0286 
0287 ; identifier with hex-escape
0288 H\x65;llo; commment
0289 H\x65;\x6c;lo; commment
0290 
0291 (while (> foo 10) ;; Highlight `while'.
0292   (set! foo (- foo 1))
0293   (catch #t ;; Highlight `catch'.
0294     (lambda () (display foo))
0295     (lambda (key . args)
0296       (if (eq? key 'system-error)
0297           (break) ;; Highlight `break'.
0298         (continue))))) ;; Highlight `continue'.