diff --git a/beautiful-racket-demo/basic-demo-3/lexer.rkt b/beautiful-racket-demo/basic-demo-3/lexer.rkt index 37d6d12..b3365f5 100644 --- a/beautiful-racket-demo/basic-demo-3/lexer.rkt +++ b/beautiful-racket-demo/basic-demo-3/lexer.rkt @@ -5,19 +5,18 @@ (define-lex-abbrev reserved-terms (:or "print" "goto" "end" "+" ":" ";" "let" "=" "input" "-" "*" "/" "^" "mod" "(" ")" "def" "if" "then" "else" "<" ">" "<>" "and" "or" "not" "gosub" "return" "for" "to" "step" "next" "def" "," "import" "export")) -(define-lex-abbrev id-kapu +(define-lex-abbrev racket-id-kapu (:or whitespace (char-set "()[]{}\",'`;#|\\"))) -(define-lex-abbrev racket-id - (:seq "[" (:~ (:or "-" id-kapu)) (:* (:~ id-kapu)) "]")) - (define basic-lexer (lexer-srcloc [(eof) (return-without-srcloc eof)] ["\n" (token 'NEWLINE lexeme)] [whitespace (token lexeme #:skip? #t)] [(from/stop-before "rem" "\n") (token 'REM lexeme)] - [racket-id (token 'RACKET-ID (string->symbol (trim-ends "[" lexeme "]")))] + [(:seq "[" (:+ (:~ racket-id-kapu)) "]") + (token 'RACKET-ID + (string->symbol (trim-ends "[" lexeme "]")))] [reserved-terms (token lexeme lexeme)] [(:seq alphabetic (:* (:or alphabetic numeric "$"))) (token 'ID (string->symbol lexeme))] diff --git a/beautiful-racket-demo/basic-demo-3/sample-export.rkt b/beautiful-racket-demo/basic-demo-3/sample-exporter.rkt similarity index 100% rename from beautiful-racket-demo/basic-demo-3/sample-export.rkt rename to beautiful-racket-demo/basic-demo-3/sample-exporter.rkt diff --git a/beautiful-racket-demo/basic-demo-3/sample-import.rkt b/beautiful-racket-demo/basic-demo-3/sample-import.rkt index 9799586..9e86a92 100644 --- a/beautiful-racket-demo/basic-demo-3/sample-import.rkt +++ b/beautiful-racket-demo/basic-demo-3/sample-import.rkt @@ -1,7 +1,7 @@ #lang basic-demo-3 -10 import math/number-theory -20 print nth-prime(15) -30 print prime?(24) -40 import racket/base -50 print max(f(1), f(2), f(5), f(4)) +10 import [math/number-theory] +20 print [nth-prime](15) +30 print [prime?](24) +40 import [racket/base] +50 print [max](f(1), f(2), f(5), f(4)) 60 def f(x) = x + x \ No newline at end of file diff --git a/beautiful-racket-demo/basic-demo-3/sample-importer.rkt b/beautiful-racket-demo/basic-demo-3/sample-importer.rkt new file mode 100644 index 0000000..a1654ec --- /dev/null +++ b/beautiful-racket-demo/basic-demo-3/sample-importer.rkt @@ -0,0 +1,5 @@ +#lang br +(require basic-demo-3/sample-exporter) +div +x +(div x 10) \ No newline at end of file diff --git a/beautiful-racket-demo/basic-demo-3/sample-require.rkt b/beautiful-racket-demo/basic-demo-3/sample-require.rkt deleted file mode 100644 index 639ca04..0000000 --- a/beautiful-racket-demo/basic-demo-3/sample-require.rkt +++ /dev/null @@ -1,5 +0,0 @@ -#lang br -(require "sample-export.rkt") -div -x -(div x 10) \ No newline at end of file diff --git a/beautiful-racket-demo/basic-demo-3/setup.rkt b/beautiful-racket-demo/basic-demo-3/setup.rkt index fd0b625..8907934 100644 --- a/beautiful-racket-demo/basic-demo-3/setup.rkt +++ b/beautiful-racket-demo/basic-demo-3/setup.rkt @@ -5,9 +5,9 @@ (define basic-output-port (make-parameter (open-output-nowhere))) -(define (do-setup!) +(define (do-setup! [where #f]) (basic-output-port (current-output-port)) - (current-read-interaction read-one-line)) + #;(current-read-interaction read-one-line)) (define repl-parser (make-rule-parser b-repl))