diff --git a/beautiful-racket-demo/basic-demo-nth/tokenizer.rkt b/beautiful-racket-demo/basic-demo-nth/tokenizer.rkt index 02d6b73..d07620c 100644 --- a/beautiful-racket-demo/basic-demo-nth/tokenizer.rkt +++ b/beautiful-racket-demo/basic-demo-nth/tokenizer.rkt @@ -1,7 +1,5 @@ #lang br -(require parser-tools/lex - (prefix-in : parser-tools/lex-sre) - brag/support) +(require brag/support) (provide tokenize basic-lexer) (define-lex-abbrevs diff --git a/beautiful-racket-demo/basic-demo/tokenizer.rkt b/beautiful-racket-demo/basic-demo/tokenizer.rkt index 9a931f5..06ad50a 100644 --- a/beautiful-racket-demo/basic-demo/tokenizer.rkt +++ b/beautiful-racket-demo/basic-demo/tokenizer.rkt @@ -1,7 +1,5 @@ #lang br -(require parser-tools/lex - (prefix-in : parser-tools/lex-sre) - brag/support) +(require brag/support) (provide (all-defined-out)) (define basic-lexer diff --git a/beautiful-racket-demo/bf-demo/reader.rkt b/beautiful-racket-demo/bf-demo/reader.rkt index a54391c..16a21ff 100644 --- a/beautiful-racket-demo/bf-demo/reader.rkt +++ b/beautiful-racket-demo/bf-demo/reader.rkt @@ -8,7 +8,7 @@ (datum->syntax #f module-datum)) (provide read-syntax) -(require parser-tools/lex) +(require brag/support) (define (tokenize port) (define (next-token) (define our-lexer diff --git a/beautiful-racket-demo/bf-demo/test-tokenizer.rkt b/beautiful-racket-demo/bf-demo/test-tokenizer.rkt index e7c3adf..ad0a2f4 100644 --- a/beautiful-racket-demo/bf-demo/test-tokenizer.rkt +++ b/beautiful-racket-demo/bf-demo/test-tokenizer.rkt @@ -1,5 +1,5 @@ #lang br -(require parser-tools/lex brag/support) +(require brag/support) (define+provide (tokenize ip) (define get-token diff --git a/beautiful-racket-demo/hdl-demo/tokenizer.rkt b/beautiful-racket-demo/hdl-demo/tokenizer.rkt index 25a350d..2bc272c 100644 --- a/beautiful-racket-demo/hdl-demo/tokenizer.rkt +++ b/beautiful-racket-demo/hdl-demo/tokenizer.rkt @@ -1,6 +1,5 @@ #lang br -(require parser-tools/lex parser-tools/lex-sre - brag/support +(require brag/support racket/string) (provide tokenize) @@ -10,10 +9,10 @@ (lexer-src-pos [(eof) eof] [(union - (seq "/*" (complement (seq any-string "*/" any-string)) "*/") - (seq "//" (repetition 1 +inf.0 (char-complement #\newline)) #\newline)) + (:seq "/*" (complement (:seq any-string "*/" any-string)) "*/") + (:seq "//" (repetition 1 +inf.0 (char-complement #\newline)) #\newline)) (token 'COMMENT lexeme #:skip? #t)] - [(union #\tab #\space #\newline) (get-token input-port)] + [(union #\tab #\space #\newline) (return-without-pos (get-token input-port))] [(union "CHIP" "IN" "OUT" "PARTS:") lexeme] [(char-set "[]{}(),;=.") lexeme] ["true" (token 'TRUE #t)] @@ -21,6 +20,6 @@ [(repetition 1 +inf.0 numeric) (token 'NUMBER (string->number lexeme))] ; bugaboo: "10" is ambiguous: number or binary number? [(repetition 1 +inf.0 (char-set "01")) (token 'BINARY-NUMBER (string->number lexeme 2))] - [(seq (repetition 1 1 alphabetic) (repetition 0 +inf.0 (union alphabetic numeric "-"))) (token 'ID (string->symbol lexeme))])) + [(:seq (repetition 1 1 alphabetic) (repetition 0 +inf.0 (union alphabetic numeric "-"))) (token 'ID (string->symbol lexeme))])) (get-token input-port)) next-token) diff --git a/beautiful-racket-demo/hdl-tst-demo/tokenizer.rkt b/beautiful-racket-demo/hdl-tst-demo/tokenizer.rkt index a5255ce..21442d4 100644 --- a/beautiful-racket-demo/hdl-tst-demo/tokenizer.rkt +++ b/beautiful-racket-demo/hdl-tst-demo/tokenizer.rkt @@ -1,6 +1,5 @@ #lang br -(require parser-tools/lex parser-tools/lex-sre - brag/support +(require brag/support racket/string) (provide tokenize) @@ -10,12 +9,12 @@ (lexer-src-pos [(eof) eof] [(union - (seq "/*" (complement (seq any-string "*/" any-string)) "*/") - (seq "//" (repetition 1 +inf.0 (char-complement #\newline)) #\newline)) + (:seq "/*" (complement (:seq any-string "*/" any-string)) "*/") + (:seq "//" (repetition 1 +inf.0 (char-complement #\newline)) #\newline)) (token 'COMMENT lexeme #:skip? #t)] - [(union #\tab #\space #\newline) (get-token input-port)] + [(union #\tab #\space #\newline) (return-without-pos (get-token input-port))] [(union "load" "output-list" "output-file" "compare-to" "set" "eval" "output" (char-set ",;")) lexeme] - [(seq "%" (repetition 1 +inf.0 (union alphabetic numeric (char-set ".")))) (token 'FORMAT-STRING lexeme)] + [(:seq "%" (repetition 1 +inf.0 (union alphabetic numeric (char-set ".")))) (token 'FORMAT-STRING lexeme)] [(repetition 1 +inf.0 numeric) (token 'VAL (string->number lexeme))] [(repetition 1 +inf.0 (union alphabetic numeric (char-set "-."))) (token 'ID lexeme)])) (get-token input-port)) diff --git a/beautiful-racket-demo/txtadv-demo/tokenizer.rkt b/beautiful-racket-demo/txtadv-demo/tokenizer.rkt index d004f25..2001188 100644 --- a/beautiful-racket-demo/txtadv-demo/tokenizer.rkt +++ b/beautiful-racket-demo/txtadv-demo/tokenizer.rkt @@ -1,6 +1,5 @@ #lang br -(require parser-tools/lex parser-tools/lex-sre - brag/support +(require brag/support racket/string) (provide tokenize) @@ -10,13 +9,13 @@ (lexer [(eof) eof] [(union - (seq "/*" (complement (seq any-string "*/" any-string)) "*/") - (seq "//" (repetition 1 +inf.0 (char-complement #\newline)) #\newline)) + (:seq "/*" (complement (:seq any-string "*/" any-string)) "*/") + (:seq "//" (repetition 1 +inf.0 (char-complement #\newline)) #\newline)) (token 'COMMENT lexeme #:skip? #t)] [(union #\tab #\space #\newline) (get-token input-port)] [(repetition 1 +inf.0 (union upper-case (char-set "="))) lexeme] - [(seq "\"" (complement (seq any-string "\"" any-string)) "\"") (token 'STRING (string-trim lexeme "\""))] - [(seq "---" + [(:seq "\"" (complement (:seq any-string "\"" any-string)) "\"") (token 'STRING (string-trim lexeme "\""))] + [(:seq "---" (repetition 1 +inf.0 (union alphabetic numeric punctuation)) "---") (token 'DASHED-NAME (string->symbol (string-trim lexeme "-" #:repeat? #t)))] [(repetition 1 +inf.0 (union alphabetic numeric (char-set "-!?.#'")))