|
|
@ -8,8 +8,8 @@
|
|
|
|
(define-lex-abbrev id-kapu
|
|
|
|
(define-lex-abbrev id-kapu
|
|
|
|
(:or whitespace (char-set "()[]{}\",'`;#|\\")))
|
|
|
|
(:or whitespace (char-set "()[]{}\",'`;#|\\")))
|
|
|
|
|
|
|
|
|
|
|
|
(define-lex-abbrev id
|
|
|
|
(define-lex-abbrev racket-id
|
|
|
|
(:seq (:~ (:or "-" id-kapu)) (:* (:~ id-kapu))))
|
|
|
|
(:seq "[" (:~ (:or "-" id-kapu)) (:* (:~ id-kapu)) "]"))
|
|
|
|
|
|
|
|
|
|
|
|
(define basic-lexer
|
|
|
|
(define basic-lexer
|
|
|
|
(lexer-srcloc
|
|
|
|
(lexer-srcloc
|
|
|
@ -17,12 +17,14 @@
|
|
|
|
["\n" (token 'NEWLINE lexeme)]
|
|
|
|
["\n" (token 'NEWLINE lexeme)]
|
|
|
|
[whitespace (token lexeme #:skip? #t)]
|
|
|
|
[whitespace (token lexeme #:skip? #t)]
|
|
|
|
[(from/stop-before "rem" "\n") (token 'REM lexeme)]
|
|
|
|
[(from/stop-before "rem" "\n") (token 'REM lexeme)]
|
|
|
|
|
|
|
|
[racket-id (token 'RACKET-ID (string->symbol (trim-ends "[" lexeme "]")))]
|
|
|
|
[reserved-terms (token lexeme lexeme)]
|
|
|
|
[reserved-terms (token lexeme lexeme)]
|
|
|
|
|
|
|
|
[(:seq alphabetic (:* (:or alphabetic numeric "$")))
|
|
|
|
|
|
|
|
(token 'ID (string->symbol lexeme))]
|
|
|
|
[digits (token 'INTEGER (string->number lexeme))]
|
|
|
|
[digits (token 'INTEGER (string->number lexeme))]
|
|
|
|
[(:or (:seq (:? digits) "." digits)
|
|
|
|
[(:or (:seq (:? digits) "." digits)
|
|
|
|
(:seq digits "."))
|
|
|
|
(:seq digits "."))
|
|
|
|
(token 'DECIMAL (string->number lexeme))]
|
|
|
|
(token 'DECIMAL (string->number lexeme))]
|
|
|
|
[id (token 'ID (string->symbol lexeme))]
|
|
|
|
|
|
|
|
[(:or (from/to "\"" "\"") (from/to "'" "'"))
|
|
|
|
[(:or (from/to "\"" "\"") (from/to "'" "'"))
|
|
|
|
(token 'STRING
|
|
|
|
(token 'STRING
|
|
|
|
(substring lexeme
|
|
|
|
(substring lexeme
|
|
|
|