From 5723af898e3ae75266d535f8544449ecea4c1bcd Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Fri, 27 Jan 2017 17:32:36 -0800 Subject: [PATCH] use br-parser-tools --- brag/brag/brag.scrbl | 14 +++++++------- brag/brag/cfg-parser/cfg-parser.rkt | 12 ++++++------ brag/brag/codegen/codegen.rkt | 6 +++--- brag/brag/codegen/runtime.rkt | 2 +- brag/brag/codegen/sexp-based-lang.rkt | 10 +++++----- brag/brag/examples/simple-line-drawing/lexer.rkt | 2 +- brag/brag/rules/lexer.rkt | 6 +++--- brag/brag/rules/parser.rkt | 6 +++--- brag/brag/rules/rule-structs.rkt | 2 +- brag/brag/rules/runtime.rkt | 2 +- brag/brag/rules/stx.rkt | 2 +- brag/brag/support.rkt | 8 ++++---- brag/brag/test/test-lexer.rkt | 2 +- brag/brag/test/test-old-token.rkt | 6 +++--- brag/brag/test/test-parser.rkt | 2 +- brag/brag/test/test-simple-arithmetic-grammar.rkt | 2 +- brag/brag/test/test-simple-line-drawing.rkt | 6 +++--- brag/info.rkt | 4 ++-- 18 files changed, 47 insertions(+), 47 deletions(-) diff --git a/brag/brag/brag.scrbl b/brag/brag/brag.scrbl index 42b0249..d249c87 100755 --- a/brag/brag/brag.scrbl +++ b/brag/brag/brag.scrbl @@ -5,7 +5,7 @@ (for-label racket brag/support brag/examples/nested-word-list - (only-in parser-tools/lex lexer-src-pos) + (only-in br-parser-tools/lex lexer-src-pos) (only-in syntax/parse syntax-parse ~literal))) @@ -256,11 +256,11 @@ A @emph{token} is the smallest meaningful element of a source program. Tokens ca If possible, we also want to attach source location information to each token. Why? Because this informatino will be incorporated into the syntax objects produced by @racket[parse]. -A parser often works in conjunction with a helper function called a @emph{lexer} that converts the raw code of the source program into tokens. The @racketmodname[parser-tools/lex] library can help us write a position-sensitive +A parser often works in conjunction with a helper function called a @emph{lexer} that converts the raw code of the source program into tokens. The @racketmodname[br-parser-tools/lex] library can help us write a position-sensitive tokenizer: @interaction[#:eval my-eval -(require parser-tools/lex) +(require br-parser-tools/lex) (define (tokenize ip) (port-count-lines! ip) (define my-lexer @@ -299,7 +299,7 @@ Note also from this lexer example: @item{@racket[parse] accepts as input either a sequence of tokens, or a function that produces tokens (which @racket[parse] will call repeatedly to get the next token).} -@item{As an alternative to the basic @racket[token] structure, a token can also be an instance of the @racket[position-token] structure (also found in @racketmodname[parser-tools/lex]). In that case, the token will try to derive its position from that of the position-token.} +@item{As an alternative to the basic @racket[token] structure, a token can also be an instance of the @racket[position-token] structure (also found in @racketmodname[br-parser-tools/lex]). In that case, the token will try to derive its position from that of the position-token.} @item{@racket[parse] will stop if it gets @racket[void] (or @racket['eof]) as a token.} @@ -811,8 +811,8 @@ A @deftech{token} in @tt{brag} can be any of the following values: @item{a string} @item{a symbol} @item{an instance produced by @racket[token]} -@item{an instance produced by the token constructors of @racketmodname[parser-tools/lex]} -@item{an instance of @racketmodname[parser-tools/lex]'s @racket[position-token] whose +@item{an instance produced by the token constructors of @racketmodname[br-parser-tools/lex]} +@item{an instance of @racketmodname[br-parser-tools/lex]'s @racket[position-token] whose @racket[position-token-token] is a @tech{token}.} ] @@ -917,7 +917,7 @@ The @racketmodname[brag/support] module provides functions to interact with @tt{brag} programs. The most useful is the @racket[token] function, which produces tokens to be parsed. -In addition to the exports shown below, the @racketmodname[brag/support] module also provides everything from @racketmodname[brag/support], and everything from @racketmodname[parser-tools/lex]. +In addition to the exports shown below, the @racketmodname[brag/support] module also provides everything from @racketmodname[brag/support], and everything from @racketmodname[br-parser-tools/lex]. @defproc[(token [type (or/c string? symbol?)] diff --git a/brag/brag/cfg-parser/cfg-parser.rkt b/brag/brag/cfg-parser/cfg-parser.rkt index 0d56f8e..1bc717b 100755 --- a/brag/brag/cfg-parser/cfg-parser.rkt +++ b/brag/brag/cfg-parser/cfg-parser.rkt @@ -1,5 +1,5 @@ #lang racket/base -;; This module implements a parser form like the parser-tools's +;; This module implements a parser form like the br-parser-tools's ;; `parser', except that it works on an arbitrary CFG (returning ;; the first sucecssful parse). @@ -23,7 +23,7 @@ ;; different lengths. (Otherwise, in the spirit of finding one ;; successful parse, only the first result is kept.) -;; The parser-tools's `parse' is used to transform tokens in the +;; The br-parser-tools's `parse' is used to transform tokens in the ;; grammar to tokens specific to this parser. In other words, this ;; parser uses `parser' so that it doesn't have to know anything about ;; tokens. @@ -31,12 +31,12 @@ -(require parser-tools/yacc - parser-tools/lex) +(require br-parser-tools/yacc + br-parser-tools/lex) (require (for-syntax racket/base syntax/boundmap - parser-tools/private-lex/token-syntax)) + br-parser-tools/private-lex/token-syntax)) (provide cfg-parser) @@ -797,7 +797,7 @@ (module* test racket/base (require (submod "..") - parser-tools/lex + br-parser-tools/lex racket/block rackunit) diff --git a/brag/brag/codegen/codegen.rkt b/brag/brag/codegen/codegen.rkt index f21a2bc..206b0b2 100755 --- a/brag/brag/codegen/codegen.rkt +++ b/brag/brag/codegen/codegen.rkt @@ -19,7 +19,7 @@ ;; FIXME: abstract this so we can just call (rules ...) without ;; generating the whole module body. (define (rules-codegen stx - #:parser-provider-module [parser-provider-module 'parser-tools/yacc] + #:parser-provider-module [parser-provider-module 'br-parser-tools/yacc] #:parser-provider-form [parser-provider-form 'parser]) (syntax-case stx () [(_ r ...) @@ -36,7 +36,7 @@ (check-all-rules-no-duplicates! rules) (check-all-rules-satisfiable! rules) - ;; We flatten the rules so we can use the yacc-style ruleset that parser-tools + ;; We flatten the rules so we can use the yacc-style ruleset that br-parser-tools ;; supports. (define flattened-rules (flatten-rules rules)) @@ -86,7 +86,7 @@ [parser-form parser-provider-form]) (quasisyntax/loc stx (begin - (require parser-tools/lex + (require br-parser-tools/lex parser-module brag/codegen/runtime brag/support diff --git a/brag/brag/codegen/runtime.rkt b/brag/brag/codegen/runtime.rkt index 58a7913..86afa55 100755 --- a/brag/brag/codegen/runtime.rkt +++ b/brag/brag/codegen/runtime.rkt @@ -3,7 +3,7 @@ (require racket/match racket/list racket/generator - (prefix-in lex: parser-tools/lex) + (prefix-in lex: br-parser-tools/lex) brag/support brag/private/internal-support) diff --git a/brag/brag/codegen/sexp-based-lang.rkt b/brag/brag/codegen/sexp-based-lang.rkt index c6aa2b3..305966a 100755 --- a/brag/brag/codegen/sexp-based-lang.rkt +++ b/brag/brag/codegen/sexp-based-lang.rkt @@ -5,7 +5,7 @@ ;; Danny Yoo (dyoo@hashcollision.org) ;; ;; Intent: make it trivial to generate languages for Racket. At the -;; moment, I find it painful to use parser-tools. This library is +;; moment, I find it painful to use br-parser-tools. This library is ;; meant to make it less agonizing. ;; ;; The intended use of this language is as follows: @@ -25,11 +25,11 @@ ;; ;; You'll still need to do a little work, by providing a lexer that ;; defines what the uppercased tokens mean. For example, you can -;; use the parser-tools/lex lexer tools: +;; use the br-parser-tools/lex lexer tools: ;; ;; (require brag/support -;; parser-tools/lex -;; parser-tools/lex-sre) +;; br-parser-tools/lex +;; br-parser-tools/lex-sre) ;; ;; (define tokenize ;; (lexer-src-pos @@ -91,6 +91,6 @@ #%top-interaction) (define-syntax (rules stx) - (rules-codegen #:parser-provider-module 'brag/cfg-parser/cfg-parser ;; 'parser-tools/yacc + (rules-codegen #:parser-provider-module 'brag/cfg-parser/cfg-parser ;; 'br-parser-tools/yacc #:parser-provider-form 'cfg-parser ;; 'parser stx)) diff --git a/brag/brag/examples/simple-line-drawing/lexer.rkt b/brag/brag/examples/simple-line-drawing/lexer.rkt index 0dd4515..3e0e810 100755 --- a/brag/brag/examples/simple-line-drawing/lexer.rkt +++ b/brag/brag/examples/simple-line-drawing/lexer.rkt @@ -4,7 +4,7 @@ ;; A simple lexer for simple-line-drawing. (require brag/support - parser-tools/lex) + br-parser-tools/lex) (define (tokenize ip) (port-count-lines! ip) diff --git a/brag/brag/rules/lexer.rkt b/brag/brag/rules/lexer.rkt index c411ba7..e55991b 100755 --- a/brag/brag/rules/lexer.rkt +++ b/brag/brag/rules/lexer.rkt @@ -1,7 +1,7 @@ #lang racket/base (require (for-syntax racket/base "parser.rkt")) -(require parser-tools/lex - (prefix-in : parser-tools/lex-sre) +(require br-parser-tools/lex + (prefix-in : br-parser-tools/lex-sre) "parser.rkt" "rule-structs.rkt" racket/string) @@ -115,7 +115,7 @@ ;; position->pos: position -> pos -;; Coerses position structures from parser-tools/lex to our own pos structures. +;; Coerses position structures from br-parser-tools/lex to our own pos structures. (define (position->pos a-pos) (pos (position-offset a-pos) (position-line a-pos) diff --git a/brag/brag/rules/parser.rkt b/brag/brag/rules/parser.rkt index 3c47886..de976cc 100755 --- a/brag/brag/rules/parser.rkt +++ b/brag/brag/rules/parser.rkt @@ -1,6 +1,6 @@ #lang racket/base -(require parser-tools/yacc - parser-tools/lex +(require br-parser-tools/yacc + br-parser-tools/lex racket/list racket/match "rule-structs.rkt") @@ -240,7 +240,7 @@ ;; position->pos: position -> pos -;; Coerses position structures from parser-tools/lex to our own pos structures. +;; Coerses position structures from br-parser-tools/lex to our own pos structures. (define (position->pos a-pos) (pos (position-offset a-pos) (position-line a-pos) diff --git a/brag/brag/rules/rule-structs.rkt b/brag/brag/rules/rule-structs.rkt index 7e9c082..5b5968e 100755 --- a/brag/brag/rules/rule-structs.rkt +++ b/brag/brag/rules/rule-structs.rkt @@ -2,7 +2,7 @@ (provide (all-defined-out)) -;; We keep our own position structure because parser-tools/lex's position +;; We keep our own position structure because br-parser-tools/lex's position ;; structure is non-transparent, hence highly resistant to unit testing. (struct pos (offset line col) #:transparent) diff --git a/brag/brag/rules/runtime.rkt b/brag/brag/rules/runtime.rkt index 45ec14a..e34df13 100755 --- a/brag/brag/rules/runtime.rkt +++ b/brag/brag/rules/runtime.rkt @@ -1,5 +1,5 @@ #lang racket/base -(require parser-tools/lex) +(require br-parser-tools/lex) (provide (all-defined-out)) diff --git a/brag/brag/rules/stx.rkt b/brag/brag/rules/stx.rkt index a5396ae..9c66685 100755 --- a/brag/brag/rules/stx.rkt +++ b/brag/brag/rules/stx.rkt @@ -1,7 +1,7 @@ #lang racket/base (require "rule-structs.rkt" - parser-tools/lex + br-parser-tools/lex racket/match syntax/strip-context) diff --git a/brag/brag/support.rkt b/brag/brag/support.rkt index 1f2eb43..6af19c1 100755 --- a/brag/brag/support.rkt +++ b/brag/brag/support.rkt @@ -1,11 +1,11 @@ #lang racket/base -(require parser-tools/lex +(require br-parser-tools/lex racket/string racket/struct - (prefix-in : parser-tools/lex-sre) + (prefix-in : br-parser-tools/lex-sre) (for-syntax racket/base)) -(provide (all-from-out parser-tools/lex) - (all-from-out parser-tools/lex-sre) +(provide (all-from-out br-parser-tools/lex) + (all-from-out br-parser-tools/lex-sre) [struct-out token-struct] token [struct-out exn:fail:parsing]) diff --git a/brag/brag/test/test-lexer.rkt b/brag/brag/test/test-lexer.rkt index 6698b65..49f3774 100755 --- a/brag/brag/test/test-lexer.rkt +++ b/brag/brag/test/test-lexer.rkt @@ -1,7 +1,7 @@ #lang racket/base (require brag/rules/lexer rackunit - parser-tools/lex) + br-parser-tools/lex) (define (l s) (define t (lex/1 (open-input-string s))) diff --git a/brag/brag/test/test-old-token.rkt b/brag/brag/test/test-old-token.rkt index 601181a..2654b68 100755 --- a/brag/brag/test/test-old-token.rkt +++ b/brag/brag/test/test-old-token.rkt @@ -5,8 +5,8 @@ (require brag/examples/simple-line-drawing brag/support racket/list - parser-tools/lex - (prefix-in : parser-tools/lex-sre) + br-parser-tools/lex + (prefix-in : br-parser-tools/lex-sre) rackunit) (define-tokens tokens (INTEGER STRING |;| EOF)) @@ -72,5 +72,5 @@ EOF ;; FIXME: add tests to make sure location is as we expect. ;; ;; FIXME: handle the EOF issue better. Something in cfg-parser -;; appears to deviate from parser-tools/yacc with regards to the stop +;; appears to deviate from br-parser-tools/yacc with regards to the stop ;; token. diff --git a/brag/brag/test/test-parser.rkt b/brag/brag/test/test-parser.rkt index a0d35c1..2b56e27 100755 --- a/brag/brag/test/test-parser.rkt +++ b/brag/brag/test/test-parser.rkt @@ -2,7 +2,7 @@ (require rackunit - parser-tools/lex + br-parser-tools/lex brag/rules/parser brag/rules/lexer brag/rules/rule-structs) diff --git a/brag/brag/test/test-simple-arithmetic-grammar.rkt b/brag/brag/test/test-simple-arithmetic-grammar.rkt index 6f14d28..1ba8f2d 100755 --- a/brag/brag/test/test-simple-arithmetic-grammar.rkt +++ b/brag/brag/test/test-simple-arithmetic-grammar.rkt @@ -2,7 +2,7 @@ (require brag/examples/simple-arithmetic-grammar brag/support racket/set - parser-tools/lex + br-parser-tools/lex racket/list rackunit) diff --git a/brag/brag/test/test-simple-line-drawing.rkt b/brag/brag/test/test-simple-line-drawing.rkt index c692168..b9e3d19 100755 --- a/brag/brag/test/test-simple-line-drawing.rkt +++ b/brag/brag/test/test-simple-line-drawing.rkt @@ -3,8 +3,8 @@ (require brag/examples/simple-line-drawing brag/support racket/list - parser-tools/lex - (prefix-in : parser-tools/lex-sre) + br-parser-tools/lex + (prefix-in : br-parser-tools/lex-sre) rackunit) (define (make-tokenizer ip) @@ -68,5 +68,5 @@ EOF ;; FIXME: add tests to make sure location is as we expect. ;; ;; FIXME: handle the EOF issue better. Something in cfg-parser -;; appears to deviate from parser-tools/yacc with regards to the stop +;; appears to deviate from br-parser-tools/yacc with regards to the stop ;; token. diff --git a/brag/info.rkt b/brag/info.rkt index 6a6ac1a..0211925 100755 --- a/brag/info.rkt +++ b/brag/info.rkt @@ -1,7 +1,7 @@ #lang setup/infotab -(define deps '("base" "parser-tools-lib" "rackunit-lib")) -(define build-deps '("at-exp-lib" "parser-tools-doc" "racket-doc" +(define deps '("base" "br-parser-tools-lib" "rackunit-lib")) +(define build-deps '("at-exp-lib" "br-parser-tools-doc" "racket-doc" "scribble-lib")) (define collection 'multi)