From be0b8854cde8826f079076b1f17d653fd49ddd0a Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 30 Dec 2015 16:58:44 -0600 Subject: [PATCH] move from mzlib/contract to racket/contract --- .../parser-tools/private-yacc/grammar.rkt | 14 +++++++------- .../private-yacc/input-file-parser.rkt | 6 +++--- .../parser-tools/private-yacc/parser-builder.rkt | 13 ++++++++----- .../parser-tools/private-yacc/table.rkt | 7 ++++--- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/parser-tools-lib/parser-tools/private-yacc/grammar.rkt b/parser-tools-lib/parser-tools/private-yacc/grammar.rkt index 5b27699..ebff00d 100644 --- a/parser-tools-lib/parser-tools/private-yacc/grammar.rkt +++ b/parser-tools-lib/parser-tools/private-yacc/grammar.rkt @@ -6,7 +6,7 @@ (require mzlib/class mzlib/list "yacc-helper.rkt" - mzlib/contract) + racket/contract) ;; Each production has a unique index 0 <= index <= number of productions (define-struct prod (lhs rhs index prec action) (make-inspector)) @@ -26,12 +26,12 @@ (define-struct prec (num assoc) (make-inspector)) (provide/contract - (make-item (prod? (union false/c natural-number/c) . -> . item?)) - (make-term (symbol? (union false/c natural-number/c) (union prec? false/c) . -> . term?)) - (make-non-term (symbol? (union false/c natural-number/c) . -> . non-term?)) - (make-prec (natural-number/c (symbols 'left 'right 'nonassoc) . -> . prec?)) - (make-prod (non-term? (vectorof (union non-term? term?)) - (union false/c natural-number/c) (union false/c prec?) syntax? . -> . prod?))) + (make-item (prod? (or/c #f natural-number/c) . -> . item?)) + (make-term (symbol? (or/c #f natural-number/c) (or/c prec? #f) . -> . term?)) + (make-non-term (symbol? (or/c #f natural-number/c) . -> . non-term?)) + (make-prec (natural-number/c (or/c 'left 'right 'nonassoc) . -> . prec?)) + (make-prod (non-term? (vectorof (or/c non-term? term?)) + (or/c #f natural-number/c) (or/c #f prec?) syntax? . -> . prod?))) (provide diff --git a/parser-tools-lib/parser-tools/private-yacc/input-file-parser.rkt b/parser-tools-lib/parser-tools/private-yacc/input-file-parser.rkt index ea5446a..7309f51 100644 --- a/parser-tools-lib/parser-tools/private-yacc/input-file-parser.rkt +++ b/parser-tools-lib/parser-tools/private-yacc/input-file-parser.rkt @@ -7,13 +7,13 @@ "../private-lex/token-syntax.rkt" "grammar.rkt" mzlib/class - mzlib/contract) + racket/contract) (require-for-template mzscheme) - +(define (is-a-grammar%? x) (is-a? x grammar%)) (provide/contract (parse-input ((listof identifier?) (listof identifier?) (listof identifier?) - (union false/c syntax?) syntax? any/c . -> . (is-a?/c grammar%))) + (or/c #f syntax?) syntax? any/c . -> . is-a-grammar%?)) (get-term-list ((listof identifier?) . -> . (listof identifier?)))) (define stx-for-original-property (read-syntax #f (open-input-string "original"))) diff --git a/parser-tools-lib/parser-tools/private-yacc/parser-builder.rkt b/parser-tools-lib/parser-tools/private-yacc/parser-builder.rkt index 20351be..1be421c 100644 --- a/parser-tools-lib/parser-tools/private-yacc/parser-builder.rkt +++ b/parser-tools-lib/parser-tools/private-yacc/parser-builder.rkt @@ -4,14 +4,17 @@ "grammar.rkt" "table.rkt" mzlib/class - mzlib/contract) + racket/contract) (require-for-template mzscheme) (provide/contract - (build-parser ((string? any/c any/c (listof identifier?) (listof identifier?) - (listof identifier?) (union syntax? false/c) syntax?) - . ->* . - (any/c any/c any/c any/c)))) + (build-parser (-> string? any/c any/c + (listof identifier?) + (listof identifier?) + (listof identifier?) + (or/c syntax? #f) + syntax? + (values any/c any/c any/c any/c)))) ;; fix-check-syntax : (listof identifier?) (listof identifier?) (listof identifier?) ;; (union syntax? false/c) syntax?) -> syntax? diff --git a/parser-tools-lib/parser-tools/private-yacc/table.rkt b/parser-tools-lib/parser-tools/private-yacc/table.rkt index 7eef2e2..f97e4d2 100644 --- a/parser-tools-lib/parser-tools/private-yacc/table.rkt +++ b/parser-tools-lib/parser-tools/private-yacc/table.rkt @@ -6,13 +6,14 @@ "lr0.rkt" "lalr.rkt" "parser-actions.rkt" - mzlib/contract + racket/contract mzlib/list mzlib/class) + (define (is-a-grammar%? x) (is-a? x grammar%)) (provide/contract - (build-table ((is-a?/c grammar%) string? any/c . -> . - (vectorof (listof (cons/c (union term? non-term?) action?)))))) + (build-table (-> is-a-grammar%? string? any/c + (vectorof (listof (cons/c (or/c term? non-term?) action?)))))) ;; A parse-table is (vectorof (listof (cons/c gram-sym? action))) ;; A grouped-parse-table is (vectorof (listof (cons/c gram-sym? (listof action))))