Get rid of `#:inspector` declarations

Mutable structs instead use the default (current inspector instead of a new child inspector) and immutable structs instead are transparent.
remotes/jackfirth/master
Jack Firth 3 years ago
parent 9c78ffcc05
commit a20f1b5a32

@ -218,7 +218,7 @@
;; (list-of (cons int (list-of (cons char-set int))))) ;; (list-of (cons int (list-of (cons char-set int)))))
;; Each transitions is a state and a list of chars with the state to transition to. ;; Each transitions is a state and a list of chars with the state to transition to.
;; The finals and transitions are sorted by state number, and duplicate free. ;; The finals and transitions are sorted by state number, and duplicate free.
(struct dfa (num-states start-state final-states/actions transitions) #:inspector (make-inspector)) (struct dfa (num-states start-state final-states/actions transitions) #:transparent)
(define loc:get-integer is:get-integer) (define loc:get-integer is:get-integer)

@ -25,15 +25,15 @@
;; ;;
;; Every re must have an index field globally different from all ;; Every re must have an index field globally different from all
;; other re index fields. ;; other re index fields.
(struct re (nullable? index) #:inspector (make-inspector)) (struct re (nullable? index) #:transparent)
(struct epsilonR re () #:inspector (make-inspector)) (struct epsilonR re () #:transparent)
(struct zeroR re () #:inspector (make-inspector)) (struct zeroR re () #:transparent)
(struct char-setR re (chars) #:inspector (make-inspector)) (struct char-setR re (chars) #:transparent)
(struct concatR re (re1 re2) #:inspector (make-inspector)) (struct concatR re (re1 re2) #:transparent)
(struct repeatR re (low high re) #:inspector (make-inspector)) (struct repeatR re (low high re) #:transparent)
(struct orR re (res) #:inspector (make-inspector)) (struct orR re (res) #:transparent)
(struct andR re (res) #:inspector (make-inspector)) (struct andR re (res) #:transparent)
(struct negR re (re) #:inspector (make-inspector)) (struct negR re (re) #:transparent)
;; e : re ;; e : re
;; The unique epsilon re ;; The unique epsilon re

@ -15,7 +15,7 @@
;; A token is either ;; A token is either
;; - symbol ;; - symbol
;; - (token symbol any) ;; - (token symbol any)
(struct token (name value) #:inspector (make-inspector)) (struct token (name value) #:transparent)
;; token-name*: token -> symbol ;; token-name*: token -> symbol
(define (token-name* t) (define (token-name* t)

@ -7,21 +7,21 @@
racket/contract) racket/contract)
;; Each production has a unique index 0 <= index <= number of productions ;; Each production has a unique index 0 <= index <= number of productions
(struct prod (lhs rhs index prec action) #:inspector (make-inspector) #:mutable) (struct prod (lhs rhs index prec action) #:mutable)
;; The dot-pos field is the index of the element in the rhs ;; The dot-pos field is the index of the element in the rhs
;; of prod that the dot immediately precedes. ;; of prod that the dot immediately precedes.
;; Thus 0 <= dot-pos <= (vector-length rhs). ;; Thus 0 <= dot-pos <= (vector-length rhs).
(struct item (prod dot-pos) #:inspector (make-inspector)) (struct item (prod dot-pos) #:transparent)
;; gram-sym = (union term? non-term?) ;; gram-sym = (union term? non-term?)
;; Each term has a unique index 0 <= index < number of terms ;; Each term has a unique index 0 <= index < number of terms
;; Each non-term has a unique index 0 <= index < number of non-terms ;; Each non-term has a unique index 0 <= index < number of non-terms
(struct term (sym index prec) #:inspector (make-inspector) #:mutable) (struct term (sym index prec) #:mutable)
(struct non-term (sym index) #:inspector (make-inspector) #:mutable) (struct non-term (sym index) #:mutable)
;; a precedence declaration. ;; a precedence declaration.
(struct prec (num assoc) #:inspector (make-inspector)) (struct prec (num assoc) #:transparent)
(provide/contract (provide/contract
[item (prod? (or/c #f natural-number/c) . -> . item?)] [item (prod? (or/c #f natural-number/c) . -> . item?)]

@ -14,8 +14,8 @@
;; be used to compare kernels ;; be used to compare kernels
;; Each kernel is assigned a unique index, 0 <= index < number of states ;; Each kernel is assigned a unique index, 0 <= index < number of states
;; trans-key = (trans-key kernel gram-sym) ;; trans-key = (trans-key kernel gram-sym)
(struct kernel (items index) #:inspector (make-inspector)) (struct kernel (items index) #:transparent)
(struct trans-key (st gs) #:inspector (make-inspector)) (struct trans-key (st gs) #:transparent)
(define (trans-key<? a b) (define (trans-key<? a b)
(define kia (kernel-index (trans-key-st a))) (define kia (kernel-index (trans-key-st a)))
@ -290,7 +290,7 @@
(enq! new-kernels (goto (car old-kernels))) (enq! new-kernels (goto (car old-kernels)))
(loop (cdr old-kernels) (cons (car old-kernels) seen-kernels))]))) (loop (cdr old-kernels) (cons (car old-kernels) seen-kernels))])))
(struct q (f l) #:inspector (make-inspector) #:mutable) (struct q (f l) #:mutable)
(define (empty-queue? q) (null? (q-f q))) (define (empty-queue? q) (null? (q-f q)))
(define (make-queue) (q null null)) (define (make-queue) (q null null))

@ -12,12 +12,12 @@
;; A reduce contains a runtime-reduce so that sharing of the reduces can ;; A reduce contains a runtime-reduce so that sharing of the reduces can
;; be easily transferred to sharing of runtime-reduces. ;; be easily transferred to sharing of runtime-reduces.
(struct action () #:inspector (make-inspector)) (struct action () #:transparent)
(struct shift action (state) #:inspector (make-inspector)) (struct shift action (state) #:transparent)
(struct reduce action (prod runtime-reduce) #:inspector (make-inspector)) (struct reduce action (prod runtime-reduce) #:transparent)
(struct accept action () #:inspector (make-inspector)) (struct accept action () #:transparent)
(struct goto action (state) #:inspector (make-inspector)) (struct goto action (state) #:transparent)
(struct no-action action () #:inspector (make-inspector)) (struct no-action action () #:transparent)
(define (reduce* p) (define (reduce* p)
(reduce p (reduce p

@ -205,7 +205,7 @@
(define (extract-no-src-pos ip) (define (extract-no-src-pos ip)
(extract-helper ip #f #f)) (extract-helper ip #f #f))
(struct stack-frame (state value start-pos end-pos) #:inspector (make-inspector)) (struct stack-frame (state value start-pos end-pos) #:transparent)
(define (make-empty-stack i) (list (stack-frame i #f #f #f))) (define (make-empty-stack i) (list (stack-frame i #f #f #f)))

Loading…
Cancel
Save