add `lexer-file-path`

pull/10/head
Matthew Butterick 7 years ago
parent 728a06cf0e
commit d1205bb8c2

@ -1,9 +1,9 @@
#lang br
(require "lexer.rkt" brag/support racket/contract)
(require "lexer.rkt" brag/support)
(define (make-tokenizer ip [path #f])
(port-count-lines! ip)
(file-path path)
(lexer-file-path path)
(define (next-token) (basic-lexer ip))
next-token)

@ -296,6 +296,10 @@ error.}
raises a @racket[exn:fail:read] error. Setting this parameter allows
DrRacket, for example, to open the file containing the error.}
@defparam[lexer-file-path source any/c]{
Alias for @racket[file-path].}
@; ----------------------------------------

@ -26,6 +26,7 @@
;; File path for highlighting errors while lexing
file-path
lexer-file-path ;; alternate name
;; Lex abbrevs for unicode char sets. See mzscheme manual section 3.4.
any-char any-string nothing alphabetic lower-case upper-case title-case
@ -334,6 +335,7 @@
(do-match lb first-pos longest-match-action match)))
(define file-path (make-parameter #f))
(define lexer-file-path file-path)
(define (do-match ip first-pos action value)
#;(printf "(action ~a ~a ~a ~a)\n"

Loading…
Cancel
Save