Greg Hendershott avatar Greg Hendershott committed 9616512

Add example.rkt. Update AUTHORS.

Comments (0)

Files changed (2)

 * Matthew Harrison -- SVG formatter
 * Steven Hazel -- Tcl lexer
 * Aslak Hellesøy -- Gherkin lexer
+* Greg Hendershott -- Racket lexer
 * Jordi Gutiérrez Hermoso -- Octave lexer
 * David Hess, Fish Software, Inc. -- Objective-J lexer
 * Varun Hiremath -- Debian control lexer

tests/examplefiles/example.rkt

+#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
+ )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.