summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGreg Hendershott <greghendershott@gmail.com>2012-08-19 14:19:13 -0400
committerGreg Hendershott <greghendershott@gmail.com>2012-08-19 14:19:13 -0400
commit5d23fe0e78b5ae9d0aacfe8851d6cf321954e0d6 (patch)
treecb8d275f14ae319842f726be33a282bdbf589e0a /tests
parentc86794c06bc28a24b2e829263508fd2b7452dec2 (diff)
downloadpygments-5d23fe0e78b5ae9d0aacfe8851d6cf321954e0d6.tar.gz
Add example.rkt. Update AUTHORS.
Diffstat (limited to 'tests')
-rw-r--r--tests/examplefiles/example.rkt105
1 files changed, 105 insertions, 0 deletions
diff --git a/tests/examplefiles/example.rkt b/tests/examplefiles/example.rkt
new file mode 100644
index 00000000..b87f7bf2
--- /dev/null
+++ b/tests/examplefiles/example.rkt
@@ -0,0 +1,105 @@
+#lang racket
+
+;; Note: This Racket file has some deliberate errors (such as invalid
+;; number literals) to demonstrate the lexer correctly highlighting
+;; them as errors.
+
+; Single-line comment style.
+
+;; Single-line comment style.
+
+#| Multi-line comment style ... on one line |#
+
+#|
+Multi-line comment style ...
+... on multiple lines
+|#
+
+(define (a-function x #:keyword [y 0])
+ (define foo0 'symbol) ; ()
+ [define foo1 'symbol] ; []
+ {define foo2 'symbol} ; {}
+ (and (append (car '(1 2 3))))
+ (regexp-match? #rx"foobar" "foobar")
+ (regexp-match? #px"foobar" "foobar")
+ (define a 1))
+ (let ([b "foo"])
+ (displayln b))
+ (for/list ([x (in-list (list 1 2 (list 3 4)))])
+ (cond
+ [(pair? x) (car x)]
+ [else x])))
+
+;; Literal number examples
+(values
+ ;; #b
+ #b1.1
+ #b-1.1
+ #b1e1
+ #b0/1
+ #b1/1
+ #b1e-1
+ #b101
+ #b2 ;highlight as error
+
+ ;; #d
+ #d-1.23
+ #d1.123
+ #d1e3
+ #d1e-22
+ #d1/2
+ #d-1/2
+ #d1
+ #d-1
+ #dZ ;highlight as error
+
+ ;; 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
+ #eZ ;highlight as error
+
+ ;; #i always float
+ #i-1.23
+ #i1.123
+ #i1e3
+ #i1e-22
+ #i1/2
+ #i-1/2
+ #i1
+ #i-1
+ #iZ ;highlight as error
+
+ ;; #o
+ #o777.777
+ #o-777.777
+ #o777e777
+ #o777e-777
+ #o3/7
+ #o-3/7
+ #o777
+ #o-777
+ #o8 ;highlight as error
+
+ ;; #x
+ #x-f.f
+ #xf.f
+ #x-f
+ #xf
+ #xG ;highlight as error
+ )