Skip to content
Browse files

made names acceptable to bison

  • Loading branch information...
1 parent b566f4b commit 07ea17039d75bc578ee4a847986b7469efa24ffa @jbclements committed May 10, 2013
Showing with 8 additions and 8 deletions.
  1. +8 −8 antlr-parser.rkt
View
16 antlr-parser.rkt
@@ -179,38 +179,38 @@
;; special-case for 1-ary case makes things
;; *much* more readabale...
[(list 'star (? string? s))
- (define new-name (get-aux-defn-name (~a name "*")))
+ (define new-name (get-aux-defn-name (~a name "_star")))
(hash-set! aux-defn-bucket
new-name
`(()
(,s ,new-name)))
new-name]
[(list 'star pat)
(define lifted-rhs-seq ((rewrite-pat-to-seq name) pat))
- (define new-name (get-aux-defn-name (~a name "*")))
+ (define new-name (get-aux-defn-name (~a name "_star")))
(hash-set! aux-defn-bucket
new-name
`(()
(,@lifted-rhs-seq ,new-name)))
new-name]
;; special-case to improve readability
[(list 'plus (? string? s))
- (define new-name (get-aux-defn-name (~a name "+")))
+ (define new-name (get-aux-defn-name (~a name "_plus")))
(hash-set! aux-defn-bucket
new-name
`((,s)
(,s ,new-name)))
new-name]
[(list 'huh (? string? s))
- (define new-name (get-aux-defn-name (~a name "*")))
+ (define new-name (get-aux-defn-name (~a name "_star")))
(hash-set! aux-defn-bucket
new-name
`(()
(,s)))
new-name]
[(list 'huh pat)
(define lifted-rhs-seq ((rewrite-pat-to-seq name) pat))
- (define new-name (get-aux-defn-name (~a name "?")))
+ (define new-name (get-aux-defn-name (~a name "_huh")))
(hash-set! aux-defn-bucket
new-name
`(()
@@ -255,9 +255,9 @@
(check-equal? ((rewrite-pat-to-nonterm "bogo") "attrs_and_vis")
"attrs_and_vis")
(check-equal? ((rewrite-pat-to-nonterm "bogo") '(star "frongy"))
- "bogo*_1")
-(check-equal? (hash-ref aux-defn-bucket "bogo*_1")
- '(() ("frongy" "bogo*_1")))
+ "bogo_star_1")
+(check-equal? (hash-ref aux-defn-bucket "bogo_star_1")
+ '(() ("frongy" "bogo_star_1")))
(reset-aux-defns!)

0 comments on commit 07ea170

Please sign in to comment.
Something went wrong with that request. Please try again.