|
|
@ -8,59 +8,59 @@
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex " ")
|
|
|
|
(lex " ")
|
|
|
|
(list (srcloc-token (token " " #:skip? #t)
|
|
|
|
(list (srcloc-token (token " " #:skip? #t)
|
|
|
|
(srcloc 'string #f #f 1 1))))
|
|
|
|
(srcloc 'string 1 0 1 1))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex "rem ignored\n")
|
|
|
|
(lex "rem ignored\n")
|
|
|
|
(list (srcloc-token (token 'REM "rem ignored")
|
|
|
|
(list (srcloc-token (token 'REM "rem ignored")
|
|
|
|
(srcloc 'string #f #f 1 11))
|
|
|
|
(srcloc 'string 1 0 1 11))
|
|
|
|
(srcloc-token (token 'NEWLINE "\n")
|
|
|
|
(srcloc-token (token 'NEWLINE "\n")
|
|
|
|
(srcloc 'string #f #f 12 1))))
|
|
|
|
(srcloc 'string 1 11 12 1))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex "print")
|
|
|
|
(lex "print")
|
|
|
|
(list (srcloc-token (token "print" "print")
|
|
|
|
(list (srcloc-token (token "print" "print")
|
|
|
|
(srcloc 'string #f #f 1 5))))
|
|
|
|
(srcloc 'string 1 0 1 5))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex "goto")
|
|
|
|
(lex "goto")
|
|
|
|
(list (srcloc-token (token "goto" "goto")
|
|
|
|
(list (srcloc-token (token "goto" "goto")
|
|
|
|
(srcloc 'string #f #f 1 4))))
|
|
|
|
(srcloc 'string 1 0 1 4))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex "end")
|
|
|
|
(lex "end")
|
|
|
|
(list (srcloc-token (token "end" "end")
|
|
|
|
(list (srcloc-token (token "end" "end")
|
|
|
|
(srcloc 'string #f #f 1 3))))
|
|
|
|
(srcloc 'string 1 0 1 3))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex "+")
|
|
|
|
(lex "+")
|
|
|
|
(list (srcloc-token (token "+" "+")
|
|
|
|
(list (srcloc-token (token "+" "+")
|
|
|
|
(srcloc 'string #f #f 1 1))))
|
|
|
|
(srcloc 'string 1 0 1 1))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex ";")
|
|
|
|
(lex ";")
|
|
|
|
(list (srcloc-token (token ";" ";")
|
|
|
|
(list (srcloc-token (token ";" ";")
|
|
|
|
(srcloc 'string #f #f 1 1))))
|
|
|
|
(srcloc 'string 1 0 1 1))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex ":")
|
|
|
|
(lex ":")
|
|
|
|
(list (srcloc-token (token ":" ":")
|
|
|
|
(list (srcloc-token (token ":" ":")
|
|
|
|
(srcloc 'string #f #f 1 1))))
|
|
|
|
(srcloc 'string 1 0 1 1))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex "12")
|
|
|
|
(lex "12")
|
|
|
|
(list (srcloc-token (token 'INTEGER 12)
|
|
|
|
(list (srcloc-token (token 'INTEGER 12)
|
|
|
|
(srcloc 'string #f #f 1 2))))
|
|
|
|
(srcloc 'string 1 0 1 2))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex "1.2")
|
|
|
|
(lex "1.2")
|
|
|
|
(list (srcloc-token (token 'DECIMAL 1.2)
|
|
|
|
(list (srcloc-token (token 'DECIMAL 1.2)
|
|
|
|
(srcloc 'string #f #f 1 3))))
|
|
|
|
(srcloc 'string 1 0 1 3))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex "12.")
|
|
|
|
(lex "12.")
|
|
|
|
(list (srcloc-token (token 'DECIMAL 12.)
|
|
|
|
(list (srcloc-token (token 'DECIMAL 12.)
|
|
|
|
(srcloc 'string #f #f 1 3))))
|
|
|
|
(srcloc 'string 1 0 1 3))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex ".12")
|
|
|
|
(lex ".12")
|
|
|
|
(list (srcloc-token (token 'DECIMAL .12)
|
|
|
|
(list (srcloc-token (token 'DECIMAL .12)
|
|
|
|
(srcloc 'string #f #f 1 3))))
|
|
|
|
(srcloc 'string 1 0 1 3))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex "\"foo\"")
|
|
|
|
(lex "\"foo\"")
|
|
|
|
(list (srcloc-token (token 'STRING "foo")
|
|
|
|
(list (srcloc-token (token 'STRING "foo")
|
|
|
|
(srcloc 'string #f #f 1 5))))
|
|
|
|
(srcloc 'string 1 0 1 5))))
|
|
|
|
(check-equal?
|
|
|
|
(check-equal?
|
|
|
|
(lex "'foo'")
|
|
|
|
(lex "'foo'")
|
|
|
|
(list (srcloc-token (token 'STRING "foo")
|
|
|
|
(list (srcloc-token (token 'STRING "foo")
|
|
|
|
(srcloc 'string #f #f 1 5))))
|
|
|
|
(srcloc 'string 1 0 1 5))))
|
|
|
|
(check-exn exn:fail:read? (lambda () (lex "x")))
|
|
|
|
(check-exn exn:fail:read? (lambda () (lex "x")))
|