Update packages

This commit is contained in:
Mateus Pinto Rodrigues
2018-10-04 13:56:56 -03:00
parent 5d03e5e124
commit d272c43bcd
785 changed files with 367265 additions and 25 deletions

View File

@@ -0,0 +1,302 @@
;; -*- racket-indent-sequence-depth: 100; racket-indent-curly-as-sequence: t; -*-
;;; NOTE: After changing this file you will need to M-x faceup-write-file
;;; to regenerate the .faceup test comparison file.
;;;
;;; NOTE: You may need to disable certain features -- for example
;;; global-paren-face-mode -- during the M-x faceup-write-file.
#lang racket
(require xml)
(provide valid-bucket-name?)
;; Various def* forms are font-locked:
(define (function foo)
#t)
(define ((curried-function x) y)
(list x y))
(define a-var 10)
(define/contract (f2 x)
(any/c . -> . any)
#t)
(define-values (1st-var 2nd-var) (values 1 2))
(define-thing foo) ;bug 276
;; let: font-lock identifiers
(let ([foo 10]
[bar 20])
foo)
(let loop ([x 10])
(unless (zero? x)
(loop (sub1 x))))
(let* ([foo 10]
[bar 20])
foo)
(let-values ([(a b) (values 1 2)])
(values a b))
(let*-values ([(a b) (values 1 2)])
(values a b))
(letrec-values ([(a b) (values 1 2)])
(values a b))
(let-syntax ([foo #'foo])
foo)
(letrec-syntax ([foo #'foo])
foo)
(let-syntaxes ([(foo) #'foo])
foo)
(letrec-syntaxes ([(foo) #'foo])
foo)
(letrec-syntaxes+values ([(foo) #'foo])
([(a b) (values 1 2)])
foo)
;; for/fold is indented correctly:
(for/fold ([str ""])
([ss '("a" "b" "c")])
(string-append str ss))
;; Auto-converts word `lambda` to `λ`:
(lambda (x) #t)
;; Or use M-C-y to insert to insert `λ` char.
;; Smart indentation for quoted lists:
'(1 2
3 4)
;; Smart indentation for vector literals:
#(1 2
3 4)
;; Smart indentation for Rackjure dict literals:
(module x rackjure
{'a 0
'b 2})
;; Silly test submodule example.
;; Try using C-c C-f to Fold (hide) it, and C-c C-u to Unfold it.
(module+ test
(require rackunit)
(check-true #t))
;; Single line comment
#|
Multi-line
comment
|#
#;(sexpr comment)
;; Nested sexpr comments
(list 2
#;2)
(list 1
#;4
#;(3))
(let (#;[x #;1]
[y 2])
y)
(define x #<<FOO
asdfasdf
asdfasdf
asdfasdf
FOO
)
#;(define x #<<BAR
asdfasdf
asdfasdf
asdfasdf
BAR
)
|identifier with spaces|
|;no comment|
| #|no comment|# |
(define (a-function x #:keyword [y 0])
(and (append (car '(1 2 3))))
(regexp-match? #rx"foobar" "foobar")
(regexp-match? #px"foobar" "foobar")
(define a 1)
(let ([a "foo"]
[b "bar"])
(displayln b))
(let* ([a "foo"]
[b "bar"])
(displayln b))
(let-values ([(a b) (values 1 2)])
#t)
(for/list ([x (in-list (list 1 2 (list 3 4)))])
(cond [(pair? x) (car x)]
[else x])))
;; Issue 261
"@|widget-id|" @|foo|
;; Issue 298
(define x (begin "|" '\|))
(define (foo)
(let ([x 10])
#t)
(let ([x 1]
[y 2])
#t)
(define 1/2-the-way 0)
(define less-than-1/2 0)
;; Self-eval examples
(values
1/2-the-way ;should NOT be self-eval
less-than-1/2 ;should NOT be self-eval
+inf.0
-inf.0
+nan.0
#t
#f
1
1.0
1/2
-1/2
#b100
#o123
#d123
#x7f7f
'symbol
'|symbol with spaces|
'|;no comment|
'| #|no comment|# |
'symbol-with-no-alpha/numeric-chars
#\c
#\space
#\newline
;; Literal number examples
;; #b
#b1.1
#b-1.1
#b1e1
#b0/1
#b1/1
#b1e-1
#b101
;; #d
#d-1.23
#d1.123
#d1e3
#d1e-22
#d1/2
#d-1/2
#d1
#d-1
;; No # reader prefix -- same as #d
-1.23
1.123
1e3
1e-22
1/2
-1/2
1
-1
;; #e
#e-1.23
#e1.123
#e1e3
#e1e-22
#e1
#e-1
#e1/2
#e-1/2
;; #i always float
#i-1.23
#i1.123
#i1e3
#i1e-22
#i1/2
#i-1/2
#i1
#i-1
;; #o
#o777.777
#o-777.777
#o777e777
#o777e-777
#o3/7
#o-3/7
#o777
#o-777
;; #x
#x-f.f
#xf.f
#x-f
#xf
))
(define/contract (valid-bucket-name? s #:keyword [dns-compliant? #t])
((string?) (#:keyword boolean?) . ->* . boolean?)
(cond
[dns-compliant?
(and (<= 3 (string-length s)) (<= (string-length s) 63)
(not (regexp-match #px"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}" s))
(for/and ([s (regexp-split #rx"\\." s)])
(define (valid-first-or-last? c)
(or (char-lower-case? (string-ref s 0))
(char-numeric? (string-ref s 0))))
(define (valid-mid? c)
(or (valid-first-or-last? c)
(equal? c #\-)))
(define len (string-length s))
(and (< 0 len)
(valid-first-or-last? (string-ref s 0))
(valid-first-or-last? (string-ref s (sub1 len)))
(or (<= len 2)
(for/and ([c (substring s 1 (sub1 len))])
(valid-mid? c))))))]
[else
(and (<= (string-length s) 255)
(for/and ([c s])
(or (char-numeric? c)
(char-lower-case? c)
(char-upper-case? c)
(equal? c #\.)
(equal? c #\-)
(equal? c #\_))))]))
(displayln "I'm running!")

View File

@@ -0,0 +1,302 @@
«m:;; »«x:-*- racket-indent-sequence-depth: 100; racket-indent-curly-as-sequence: t; -*-
»
«m:;;; »«x:NOTE: After changing this file you will need to M-x faceup-write-file
»«m:;;; »«x:to regenerate the .faceup test comparison file.
»«m:;;;»«x:
»«m:;;; »«x:NOTE: You may need to disable certain features -- for example
»«m:;;; »«x:global-paren-face-mode -- during the M-x faceup-write-file.
»
«k:#lang» «v:racket»
(«k:require» xml)
(«k:provide» valid-bucket-name?)
«m:;; »«x:Various def* forms are font-locked:
»
(«k:define» («f:function» foo)
«:racket-selfeval-face:#t»)
(«k:define» ((«f:curried-function» x) y)
(«b:list» x y))
(«k:define» «v:a-var» «:racket-selfeval-face:10»)
(«b:define/contract» («f:f2» x)
(«b:any/c» . «b:->» . «b:any»)
«:racket-selfeval-face:#t»)
(«k:define-values» («v:1st-var 2nd-var») («b:values» «:racket-selfeval-face:1» «:racket-selfeval-face:2»))
(define-thing «v:foo») «m:;»«x:bug 276
»
«m:;; »«x:let: font-lock identifiers
»
(«k:let» ([«v:foo» «:racket-selfeval-face:10»]
[«v:bar» «:racket-selfeval-face:20»])
foo)
(«k:let» «f:loop» ([«v:x» «:racket-selfeval-face:10»])
(«k:unless» («b:zero?» x)
(loop («b:sub1» x))))
(«k:let*» ([«v:foo» «:racket-selfeval-face:10»]
[«v:bar» «:racket-selfeval-face:20»])
foo)
(«k:let-values» ([(«v:a» «v:b») («b:values» «:racket-selfeval-face:1» «:racket-selfeval-face:2»)])
(«b:values» a b))
(«k:let*-values» ([(«v:a» «v:b») («b:values» «:racket-selfeval-face:1» «:racket-selfeval-face:2»)])
(«b:values» a b))
(«k:letrec-values» ([(«v:a» «v:b») («b:values» «:racket-selfeval-face:1» «:racket-selfeval-face:2»)])
(«b:values» a b))
(«k:let-syntax» ([«v:foo» #«:racket-selfeval-face:'foo»])
foo)
(«k:letrec-syntax» ([«v:foo» #«:racket-selfeval-face:'foo»])
foo)
(«k:let-syntaxes» ([(«v:foo») #«:racket-selfeval-face:'foo»])
foo)
(«k:letrec-syntaxes» ([(«v:foo») #«:racket-selfeval-face:'foo»])
foo)
(«k:letrec-syntaxes+values» ([(«v:foo») #«:racket-selfeval-face:'foo»])
([(a b) («b:values» «:racket-selfeval-face:1» «:racket-selfeval-face:2»)])
foo)
«m:;; »«x:for/fold is indented correctly:
»(«k:for/fold» ([str «s:""»])
([ss '(«s:"a"» «s:"b"» «s:"c"»)])
(«b:string-append» str ss))
«m:;; »«x:Auto-converts word `lambda` to `λ`:
»(«k:lambda» (x) «:racket-selfeval-face:#t»)
«m:;; »«x:Or use M-C-y to insert to insert `λ` char.
»
«m:;; »«x:Smart indentation for quoted lists:
»'(«:racket-selfeval-face:1» «:racket-selfeval-face:2»
«:racket-selfeval-face:3» «:racket-selfeval-face:4»)
«m:;; »«x:Smart indentation for vector literals:
»#(«:racket-selfeval-face:1» «:racket-selfeval-face:2»
«:racket-selfeval-face:3» «:racket-selfeval-face:4»)
«m:;; »«x:Smart indentation for Rackjure dict literals:
»(«k:module» «f:x» «v:rackjure»
{«:racket-selfeval-face:'a» «:racket-selfeval-face:0»
«:racket-selfeval-face:'b» «:racket-selfeval-face:2»})
«m:;; »«x:Silly test submodule example.
»«m:;; »«x:Try using C-c C-f to Fold (hide) it, and C-c C-u to Unfold it.
»(«k:module+» «f:test»
(«k:require» rackunit)
(check-true «:racket-selfeval-face:#t»))
«m:;; »«x:Single line comment
»
«x:#|
Multi-line
comment
|#»
«m:#;»«x:(sexpr comment)»
«m:;; »«x:Nested sexpr comments
»
(«b:list» «:racket-selfeval-face:2»
«m:#;»«x:2»)
(«b:list» «:racket-selfeval-face:1»
«m:#;»«x:4»
«m:#;»«x:(3)»)
(«k:let» («m:#;»«x:[x #;1]»
[«v:y» «:racket-selfeval-face:2»])
y)
(«k:define» «v:x» «:racket-here-string-face:#<<FOO
asdfasdf
asdfasdf
asdfasdf
FOO
» )
«m:#;»«x:(define x #<<BAR
asdfasdf
asdfasdf
asdfasdf
BAR
|identifier with spaces|
|;no comment|
| #|no comment|# |
(«k:define» («f:a-function» x «:racket-keyword-argument-face:#:keyword» [y «:racket-selfeval-face:0»])
(«k:and» («b:append» («b:car» '(«:racket-selfeval-face:1» «:racket-selfeval-face:2» «:racket-selfeval-face:3»))))
(«b:regexp-match?» «:racket-selfeval-face:#rx»«s:"foobar"» «s:"foobar"»)
(«b:regexp-match?» «:racket-selfeval-face:#px»«s:"foobar"» «s:"foobar"»)
(«k:define» «v:a» «:racket-selfeval-face:1»)
(«k:let» ([«v:a» «s:"foo"»]
[«v:b» «s:"bar"»])
(«b:displayln» b))
(«k:let*» ([«v:a» «s:"foo"»]
[«v:b» «s:"bar"»])
(«b:displayln» b))
(«k:let-values» ([(«v:a» «v:b») («b:values» «:racket-selfeval-face:1» «:racket-selfeval-face:2»)])
«:racket-selfeval-face:#t»)
(«k:for/list» ([x («k:in-list» («b:list» «:racket-selfeval-face:1» «:racket-selfeval-face:2» («b:list» «:racket-selfeval-face:3» «:racket-selfeval-face:4»)))])
(«k:cond» [(«b:pair?» x) («b:car» x)]
[«k:else» x])))
«m:;; »«x:Issue 261
»«s:"@|widget-id|"» @|foo|
«m:;; »«x:Issue 298
»(«k:define» «v:x» («k:begin» «s:"|"» '\|))
(«k:define» («f:foo»)
(«k:let» ([«v:x» «:racket-selfeval-face:10»])
«:racket-selfeval-face:#t»)
(«k:let» ([«v:x» «:racket-selfeval-face:1»]
[«v:y» «:racket-selfeval-face:2»])
«:racket-selfeval-face:#t»)
(«k:define» «v:1/2-the-way» «:racket-selfeval-face:0»)
(«k:define» «v:less-than-1/2» «:racket-selfeval-face:0»)
«m:;; »«x:Self-eval examples
» («b:values»
1/2-the-way «m:;»«x:should NOT be self-eval
» less-than-1/2 «m:;»«x:should NOT be self-eval
» «:racket-selfeval-face:+inf.0»
«:racket-selfeval-face:-inf.0»
«:racket-selfeval-face:+nan.0»
«:racket-selfeval-face:#t»
«:racket-selfeval-face:#f»
«:racket-selfeval-face:1»
«:racket-selfeval-face:1.0»
«:racket-selfeval-face:1/2»
«:racket-selfeval-face:-1/2»
«:racket-selfeval-face:#b100»
«:racket-selfeval-face:#o123»
«:racket-selfeval-face:#d123»
«:racket-selfeval-face:#x7f7f»
«:racket-selfeval-face:'symbol»
«:racket-selfeval-face:'|symbol with spaces|»
«:racket-selfeval-face:'|;no comment|»
«:racket-selfeval-face:'| #|no comment|# |»
«:racket-selfeval-face:'symbol-with-no-alpha/numeric-chars»
«:racket-selfeval-face:#\c»
«:racket-selfeval-face:#\space»
«:racket-selfeval-face:#\newline»
«m:;; »«x:Literal number examples
»
«m:;; »«x:#b
» «:racket-selfeval-face:#b1.1»
«:racket-selfeval-face:#b-1.1»
«:racket-selfeval-face:#b1e1»
«:racket-selfeval-face:#b0/1»
«:racket-selfeval-face:#b1/1»
«:racket-selfeval-face:#b1e-1»
«:racket-selfeval-face:#b101»
«m:;; »«x:#d
» «:racket-selfeval-face:#d-1.23»
«:racket-selfeval-face:#d1.123»
«:racket-selfeval-face:#d1e3»
«:racket-selfeval-face:#d1e-22»
«:racket-selfeval-face:#d1/2»
«:racket-selfeval-face:#d-1/2»
«:racket-selfeval-face:#d1»
«:racket-selfeval-face:#d-1»
«m:;; »«x:No # reader prefix -- same as #d
» «:racket-selfeval-face:-1.23»
«:racket-selfeval-face:1.123»
«:racket-selfeval-face:1e3»
«:racket-selfeval-face:1e-22»
«:racket-selfeval-face:1/2»
«:racket-selfeval-face:-1/2»
«:racket-selfeval-face:1»
«:racket-selfeval-face:-1»
«m:;; »«x:#e
» «:racket-selfeval-face:#e-1.23»
«:racket-selfeval-face:#e1.123»
«:racket-selfeval-face:#e1e3»
«:racket-selfeval-face:#e1e-22»
«:racket-selfeval-face:#e1»
«:racket-selfeval-face:#e-1»
«:racket-selfeval-face:#e1/2»
«:racket-selfeval-face:#e-1/2»
«m:;; »«x:#i always float
» «:racket-selfeval-face:#i-1.23»
«:racket-selfeval-face:#i1.123»
«:racket-selfeval-face:#i1e3»
«:racket-selfeval-face:#i1e-22»
«:racket-selfeval-face:#i1/2»
«:racket-selfeval-face:#i-1/2»
«:racket-selfeval-face:#i1»
«:racket-selfeval-face:#i-1»
«m:;; »«x:#o
» «:racket-selfeval-face:#o777.777»
«:racket-selfeval-face:#o-777.777»
«:racket-selfeval-face:#o777e777»
«:racket-selfeval-face:#o777e-777»
«:racket-selfeval-face:#o3/7»
«:racket-selfeval-face:#o-3/7»
«:racket-selfeval-face:#o777»
«:racket-selfeval-face:#o-777»
«m:;; »«x:#x
» «:racket-selfeval-face:#x-f.f»
«:racket-selfeval-face:#xf.f»
«:racket-selfeval-face:#x-f»
«:racket-selfeval-face:#xf»
))
(«b:define/contract» («f:valid-bucket-name?» s «:racket-keyword-argument-face:#:keyword» [dns-compliant? «:racket-selfeval-face:#t»])
((«b:string?») («:racket-keyword-argument-face:#:keyword» «b:boolean?») . «b:->*» . «b:boolean?»)
(«k:cond»
[dns-compliant?
(«k:and» («b:<=» «:racket-selfeval-face:3» («b:string-length» s)) («b:<=» («b:string-length» s) «:racket-selfeval-face:63»)
(«b:not» («b:regexp-match» «:racket-selfeval-face:#px»«s:"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"» s))
(«k:for/and» ([s («b:regexp-split» «:racket-selfeval-face:#rx»«s:"\\."» s)])
(«k:define» («f:valid-first-or-last?» c)
(«k:or» («b:char-lower-case?» («b:string-ref» s «:racket-selfeval-face:0»))
(«b:char-numeric?» («b:string-ref» s «:racket-selfeval-face:0»))))
(«k:define» («f:valid-mid?» c)
(«k:or» (valid-first-or-last? c)
(«b:equal?» c «:racket-selfeval-face:#\-»)))
(«k:define» «v:len» («b:string-length» s))
(«k:and» («b:<» «:racket-selfeval-face:0» len)
(valid-first-or-last? («b:string-ref» s «:racket-selfeval-face:0»))
(valid-first-or-last? («b:string-ref» s («b:sub1» len)))
(«k:or» («b:<=» len «:racket-selfeval-face:2»)
(«k:for/and» ([c («b:substring» s «:racket-selfeval-face:1» («b:sub1» len))])
(valid-mid? c))))))]
[«k:else»
(«k:and» («b:<=» («b:string-length» s) «:racket-selfeval-face:255»)
(«k:for/and» ([c s])
(«k:or» («b:char-numeric?» c)
(«b:char-lower-case?» c)
(«b:char-upper-case?» c)
(«b:equal?» c «:racket-selfeval-face:#\.»)
(«b:equal?» c «:racket-selfeval-face:#\-»)
(«b:equal?» c «:racket-selfeval-face:#\_»))))]))
(«b:displayln» «s:"I'm running!"»)

View File

@@ -0,0 +1,325 @@
;; -*- racket-indent-sequence-depth: 100; racket-indent-curly-as-sequence: t; -*-
;;; NOTE: After changing this file you will need to M-x faceup-write-file
;;; to regenerate the .faceup test comparison file.
;;;
;;; NOTE: You may need to disable certain features -- for example
;;; global-paren-face-mode -- during the M-x faceup-write-file.
;;; Quoted list
'(a b
(a b
c))
'((1) 2 3
(3)
4 5)
;;; Quasiquoted list (align with head) and unquote or unquote-splicing
;;; (use normal indent rules for the form).
`(Part ()
(PartNumber ()
,part)
(ETag ()
,etag))
`((,(x)
,y))
`(Delete
,@(for/list ([p (in-list paths)])
`(Object ()
(Key () ,p))))
;;; Syntax
#'(for/list ([x xs])
x)
#`(for/list ([x xs])
x)
#'(#%app (#%app hasheq (quote a) (quote 42))
(quote a))
(#%app (#%app hasheq (quote a) (quote 42))
(quote a))
#'(foo (#%app hasheq (quote a) (quote 42))
(quote a))
;;; Rackjure style dictionary (when racket-indent-curly-as-sequence is t).
{a b
c d}
{a b
c d
b '(a x
s (x y
x v))}
;;; Vector
#(a b
c d)
;;; List with a keyword as first member (e.g. in many contracts)
(#:x y
#:y x)
;;; Normal function application.
(foobar x
y
z)
(foobar
x
y
z)
(dict-set a
b
c)
(dict-set
a
b
c)
(call-with-values (lambda () (values 1 2))
+)
(call-with-values
(lambda () (values 1 2))
+)
;;; Forms with special indentation
(let ([x 0])
x)
;; indent 2
(syntax-case stx ()
[(_ x) #'#f]
[(_ x y) #'#t])
;; indent 3
(syntax-case* stx () x
[(_ x) #'#f]
[(_ x y) #'#t])
(syntax-case*
stx
(#%module-begin
module
define-values
define-syntaxes
define
define/contract
define-syntax
struct
define-struct)
x
[(_ x) #'#f]
[(_ x y) #'#t])
;; begin and cond have 0 style
(begin
0
0)
(begin 0
0)
(cond [1 2]
[3 4])
(cond
[1 2]
[3 4])
(if a
x
x)
;; begin*
(begin-for-foo 0
0)
(begin-for-foo
0
0)
(with-handlers ([x y])
a b c)
;; def, with-, call-with- and other 'defun style
(define (x) x x
x)
(struct x x
())
(match-define (list x y)
(list 1 2))
(with-output-to-file path #:mode 'text #:exists 'replace
(λ () (display "Hello, world.")))
(call-with-output-file path #:mode 'text #:exists 'replace
(λ (out) (display "Hello, world." out)))
;;; Special forms: When the first non-distinguished form is on the
;;; same line as distinguished forms, disregard it for indent.
;; module has indent 2
(module 1
2
3
4
5)
;; Normal case
(module 1 2
3
4
5)
;; Weird case -- but this is how scheme-mode indents it.
(module 1 2 3
4
5)
;; Weird case -- but this is how scheme-mode indents it.
(module 1 2 3 4
5)
;;; for/fold
;; for/fold untyped, accum on same line
(for/fold ([a 0]
[b 0])
([x 0]
[y 0])
#t)
;; for/fold untyped, accum on different line
(for/fold
([a 0]
[b 0])
([x 0]
[y 0])
#t)
;; for/fold typed, type on same line
(for/fold : T
([a 0]
[b 0])
([x 0]
[y 0])
#t)
;; for/fold typed, type on different line
(for/fold
: T
([a 0]
[b 0])
([x 0]
[y 0])
#t)
;;; Bug #50
'((x
y) A
z
(x
y) A
z)
(match args
[(list x) (x
y)] ...
[(list x) (x y)] ...
[(list x) (x y)] ...)
(define-syntax (fstruct stx)
(syntax-parse stx
[(_ id:id (field:id ...))
(with-syntax ([(accessor ...)
(for/list ([fld (in-list (syntax->list #'(field ...)))])
(format-id stx "~a-~a" (syntax->datum #'id) fld))])
#'(serializable-struct
id (field ...) #:transparent
#:property prop:procedure
(lambda (self . args)
(match args
[(list 'field) (accessor self)] ...
[(list (list 'field)) (accessor self)] ...
[(list (list-rest 'field fields)) ((accessor self) fields)] ...
[(list-rest 'field f args)
(struct-copy id self
[field (apply f (accessor self) args)])] ...
[(list-rest (list 'field) f args) ;<-- THIS SEXPR IS INDENTED TOO FAR
(struct-copy id self
[field (apply f (accessor self) args)])] ...
[(list-rest (list-rest 'field fields) args)
(struct-copy id self
[field (apply (accessor self) fields args)])] ...))))]))
;; Bug #123
#hash([a . (#hash()
0)]
[b . (#hasheq()
0)]
[c . (#fx(0 1 2)
0)]
[d . (#fx3(0 1 2)
0)]
[e . (#fl(0.0 1.0 2.0)
0)]
[f . (#fl3(0.0 1.0 2.0)
0)]
[g . (#s(foo x)
0)]
[h . (#3(0 1 2)
0)])
;; Bug #136
#;(list 1
#;2
3)
(list 1
#;(list 1
(let ([x 2]
#;[y 3])
x)
3)
2
3)
;; Bug #243
(cond [x y
z]
[(= a x) y
z])
;; Bug #262
(define-metafunction λL
: (x ...) ... -> (x ...)
[( any_ls ...)
,(apply append (term (any_ls ...)))])

View File

@@ -0,0 +1,325 @@
«m:;; »«x:-*- racket-indent-sequence-depth: 100; racket-indent-curly-as-sequence: t; -*-
»
«m:;;; »«x:NOTE: After changing this file you will need to M-x faceup-write-file
»«m:;;; »«x:to regenerate the .faceup test comparison file.
»«m:;;;»«x:
»«m:;;; »«x:NOTE: You may need to disable certain features -- for example
»«m:;;; »«x:global-paren-face-mode -- during the M-x faceup-write-file.
»
«m:;;; »«x:Quoted list
»
'(a b
(a b
c))
'((«:racket-selfeval-face:1») «:racket-selfeval-face:2» «:racket-selfeval-face:3»
(«:racket-selfeval-face:3»)
«:racket-selfeval-face:4» «:racket-selfeval-face:5»)
«m:;;; »«x:Quasiquoted list (align with head) and unquote or unquote-splicing
»«m:;;; »«x:(use normal indent rules for the form).
»
`(Part ()
(PartNumber ()
,part)
(ETag ()
,etag))
`((,(x)
,y))
`(Delete
,@(«k:for/list» ([p («k:in-list» paths)])
`(«t:Object» ()
(Key () ,p))))
«m:;;; »«x:Syntax
»
#'(«k:for/list» ([x xs])
x)
#`(«k:for/list» ([x xs])
x)
#'(«k:#%app» («k:#%app» «b:hasheq» («k:quote» a) («k:quote» «:racket-selfeval-face:42»))
(«k:quote» a))
(«k:#%app» («k:#%app» «b:hasheq» («k:quote» a) («k:quote» «:racket-selfeval-face:42»))
(«k:quote» a))
#'(foo («k:#%app» «b:hasheq» («k:quote» a) («k:quote» «:racket-selfeval-face:42»))
(«k:quote» a))
«m:;;; »«x:Rackjure style dictionary (when racket-indent-curly-as-sequence is t).
»
{a b
c d}
{a b
c d
b '(a x
s (x y
x v))}
«m:;;; »«x:Vector
»
#(a b
c d)
«m:;;; »«x:List with a keyword as first member (e.g. in many contracts)
»
(«:racket-keyword-argument-face:#:x» y
«:racket-keyword-argument-face:#:y» x)
«m:;;; »«x:Normal function application.
»
(foobar x
y
z)
(foobar
x
y
z)
(«b:dict-set» a
b
c)
(«b:dict-set»
a
b
c)
(«b:call-with-values» («k:lambda» () («b:values» «:racket-selfeval-face:1» «:racket-selfeval-face:2»))
«b:+»)
(«b:call-with-values»
(«k:lambda» () («b:values» «:racket-selfeval-face:1» «:racket-selfeval-face:2»))
«b:+»)
«m:;;; »«x:Forms with special indentation
»
(«k:let» ([«v:x» «:racket-selfeval-face:0»])
x)
«m:;; »«x:indent 2
»
(«k:syntax-case» stx ()
[(«k:_» x) #«:racket-selfeval-face:'#f»]
[(«k:_» x y) #«:racket-selfeval-face:'#t»])
«m:;; »«x:indent 3
»
(«k:syntax-case*» stx () x
[(«k:_» x) #«:racket-selfeval-face:'#f»]
[(«k:_» x y) #«:racket-selfeval-face:'#t»])
(«k:syntax-case*»
stx
(«k:#%module-begin»
«k:module»
«k:define-values»
«k:define-syntaxes»
«k:define»
«b:define/contract»
«k:define-syntax»
«k:struct»
«k:define-struct»)
x
[(«k:_» x) #«:racket-selfeval-face:'#f»]
[(«k:_» x y) #«:racket-selfeval-face:'#t»])
«m:;; »«x:begin and cond have 0 style
»(«k:begin»
«:racket-selfeval-face:0»
«:racket-selfeval-face:0»)
(«k:begin» «:racket-selfeval-face:0»
«:racket-selfeval-face:0»)
(«k:cond» [«:racket-selfeval-face:1» «:racket-selfeval-face:2»]
[«:racket-selfeval-face:3» «:racket-selfeval-face:4»])
(«k:cond»
[«:racket-selfeval-face:1» «:racket-selfeval-face:2»]
[«:racket-selfeval-face:3» «:racket-selfeval-face:4»])
(«k:if» a
x
x)
«m:;; »«x:begin*
»
(begin-for-foo «:racket-selfeval-face:0»
«:racket-selfeval-face:0»)
(begin-for-foo
«:racket-selfeval-face:0»
«:racket-selfeval-face:0»)
(«k:with-handlers» ([x y])
a b c)
«m:;; »«x:def, with-, call-with- and other 'defun style
»
(«k:define» («f:x») x x
x)
(«k:struct» x x
())
(«b:match-define» («b:list» x y)
(«b:list» «:racket-selfeval-face:1» «:racket-selfeval-face:2»))
(«k:with-output-to-file» path «:racket-keyword-argument-face:#:mode» «:racket-selfeval-face:'text» «:racket-keyword-argument-face:#:exists» «:racket-selfeval-face:'replace»
(«k:λ» () («b:display» «s:"Hello, world."»)))
(«k:call-with-output-file» path «:racket-keyword-argument-face:#:mode» «:racket-selfeval-face:'text» «:racket-keyword-argument-face:#:exists» «:racket-selfeval-face:'replace»
(«k:λ» (out) («b:display» «s:"Hello, world."» out)))
«m:;;; »«x:Special forms: When the first non-distinguished form is on the
»«m:;;; »«x:same line as distinguished forms, disregard it for indent.
»
«m:;; »«x:module has indent 2
»
(«k:module» «:racket-selfeval-face:1»
«:racket-selfeval-face:2»
«:racket-selfeval-face:3»
«:racket-selfeval-face:4»
«:racket-selfeval-face:5»)
«m:;; »«x:Normal case
»(«k:module» «:racket-selfeval-face:1» «:racket-selfeval-face:2»
«:racket-selfeval-face:3»
«:racket-selfeval-face:4»
«:racket-selfeval-face:5»)
«m:;; »«x:Weird case -- but this is how scheme-mode indents it.
»(«k:module» «:racket-selfeval-face:1» «:racket-selfeval-face:2» «:racket-selfeval-face:3»
«:racket-selfeval-face:4»
«:racket-selfeval-face:5»)
«m:;; »«x:Weird case -- but this is how scheme-mode indents it.
»(«k:module» «:racket-selfeval-face:1» «:racket-selfeval-face:2» «:racket-selfeval-face:3» «:racket-selfeval-face:4»
«:racket-selfeval-face:5»)
«m:;;; »«x:for/fold
»
«m:;; »«x:for/fold untyped, accum on same line
»(«k:for/fold» ([a «:racket-selfeval-face:0»]
[b «:racket-selfeval-face:0»])
([x «:racket-selfeval-face:0»]
[y «:racket-selfeval-face:0»])
«:racket-selfeval-face:#t»)
«m:;; »«x:for/fold untyped, accum on different line
»(«k:for/fold»
([a «:racket-selfeval-face:0»]
[b «:racket-selfeval-face:0»])
([x «:racket-selfeval-face:0»]
[y «:racket-selfeval-face:0»])
«:racket-selfeval-face:#t»)
«m:;; »«x:for/fold typed, type on same line
»(«k:for/fold» «b::» T
([a «:racket-selfeval-face:0»]
[b «:racket-selfeval-face:0»])
([x «:racket-selfeval-face:0»]
[y «:racket-selfeval-face:0»])
«:racket-selfeval-face:#t»)
«m:;; »«x:for/fold typed, type on different line
»(«k:for/fold»
«b::» T
([a «:racket-selfeval-face:0»]
[b «:racket-selfeval-face:0»])
([x «:racket-selfeval-face:0»]
[y «:racket-selfeval-face:0»])
«:racket-selfeval-face:#t»)
«m:;;; »«x:Bug #50
»
'((x
y) A
z
(x
y) A
z)
(«b:match» args
[(«b:list» x) (x
y)] «k:...»
[(«b:list» x) (x y)] «k:...»
[(«b:list» x) (x y)] «k:...»)
(«k:define-syntax» («f:fstruct» stx)
(«b:syntax-parse» stx
[(«k:_» id:id (field:id «k:...»))
(«k:with-syntax» ([(accessor «k:...»)
(«k:for/list» ([fld («k:in-list» («b:syntax->list» #'(«b:field» «k:...»)))])
(«b:format-id» stx «s:"~a-~a"» («b:syntax->datum» #«:racket-selfeval-face:'id») fld))])
#'(serializable-struct
id («b:field» «k:...») «:racket-keyword-argument-face:#:transparent»
«:racket-keyword-argument-face:#:property» «b:prop:procedure»
(«k:lambda» (self . args)
(«b:match» args
[(«b:list» «:racket-selfeval-face:'field») (accessor self)] «k:...»
[(«b:list» («b:list» «:racket-selfeval-face:'field»)) (accessor self)] «k:...»
[(«b:list» (list-rest «:racket-selfeval-face:'field» fields)) ((accessor self) fields)] «k:...»
[(list-rest «:racket-selfeval-face:'field» f args)
(«k:struct-copy» id self
[«b:field» («k:apply» f (accessor self) args)])] «k:...»
[(list-rest («b:list» «:racket-selfeval-face:'field») f args) «m:;»«x:<-- THIS SEXPR IS INDENTED TOO FAR
» («k:struct-copy» id self
[«b:field» («k:apply» f (accessor self) args)])] «k:...»
[(list-rest (list-rest «:racket-selfeval-face:'field» fields) args)
(«k:struct-copy» id self
[«b:field» («k:apply» (accessor self) fields args)])] «k:...»))))]))
«m:;; »«x:Bug #123
»
#hash([a . (#hash()
«:racket-selfeval-face:0»)]
[b . (#hasheq()
«:racket-selfeval-face:0»)]
[c . (#fx(«:racket-selfeval-face:0» «:racket-selfeval-face:1» «:racket-selfeval-face:2»)
«:racket-selfeval-face:0»)]
[d . (#fx3(«:racket-selfeval-face:0» «:racket-selfeval-face:1» «:racket-selfeval-face:2»)
«:racket-selfeval-face:0»)]
[e . (#fl(«:racket-selfeval-face:0.0» «:racket-selfeval-face:1.0» «:racket-selfeval-face:2.0»)
«:racket-selfeval-face:0»)]
[f . (#fl3(«:racket-selfeval-face:0.0» «:racket-selfeval-face:1.0» «:racket-selfeval-face:2.0»)
«:racket-selfeval-face:0»)]
[g . (#s(foo x)
«:racket-selfeval-face:0»)]
[h . (#3(«:racket-selfeval-face:0» «:racket-selfeval-face:1» «:racket-selfeval-face:2»)
«:racket-selfeval-face:0»)])
«m:;; »«x:Bug #136
»
«m:#;»«x:(list 1
#;2
3)»
(«b:list» «:racket-selfeval-face:1»
«m:#;»«x:(list 1
(let ([x 2]
#;[y 3])
x)
3)»
«:racket-selfeval-face:2»
«:racket-selfeval-face:3»)
«m:;; »«x:Bug #243
»(«k:cond» [x y
z]
[(«b:=» a x) y
z])
«m:;; »«x:Bug #262
»(define-metafunction «v:λL»
«b::» (x «k:...») «k:...» «b:->» (x «k:...»)
[( any_ls «k:...»)
,(«k:apply» «b:append» (term (any_ls «k:...»)))])