dev-srcloc
Matthew Butterick 8 years ago
parent cacbd37b14
commit 7f08f2e2c8

@ -5,8 +5,8 @@
(define our-lexer (define our-lexer
(lexer (lexer
[(eof) eof] [(eof) eof]
[(delimited-by "//" "\n") (next-token)] [(between "//" "\n") (next-token)]
[(delimited-by "@$" "$@") [(between "@$" "$@")
(token 'SEXP-TOK (trim-delimiters "@$" lexeme "$@"))] (token 'SEXP-TOK (trim-delimiters "@$" lexeme "$@"))]
[any-char (token 'CHAR-TOK lexeme)])) [any-char (token 'CHAR-TOK lexeme)]))
(our-lexer port)) (our-lexer port))

@ -983,11 +983,11 @@ Repeatedly apply @racket[tokenizer] to @racket[source-string], gathering the res
} }
@defproc[(trim-delimiters [left-delimiter string?] @defproc[(trim-ends [left-str string?]
[str string?] [str string?]
[right-delimiter string?]) [right-str string?])
string?]{ string?]{
Remove @racket[left-delimiter] from the left side of @racket[str], and @racket[right-delimiter] from its right side. Intended as a helper function for @racket[delimited-by]. Remove @racket[left-str] from the left side of @racket[str], and @racket[right-str] from its right side. Intended as a helper function for @racket[between].
} }
@ -1050,9 +1050,9 @@ one character.}
Character ranges, matching characters between successive pairs of Character ranges, matching characters between successive pairs of
characters.} characters.}
@defform[(delimited-by open close)]{ @defform[(between open close)]{
A string that is bounded by the @racket[open] and @racket[close] delimiters. Matching is non-greedy (meaning, it stops at the first occurence of @racket[close]). The resulting lexeme includes the delimiters. To remove them, see @racket[trim-delimiters].} A string that is bounded by @racket[open] and @racket[close]. Matching is non-greedy (meaning, it stops at the first occurence of @racket[close]). The resulting lexeme includes @racket[open] and @racket[close]. To remove them, see @racket[trim-ends].}
@close-eval[my-eval] @close-eval[my-eval]

Loading…
Cancel
Save