You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
562 B
Racket
16 lines
562 B
Racket
3 years ago
|
#lang racket/base
|
||
|
(provide (all-defined-out))
|
||
|
(require syntax/stx)
|
||
|
|
||
|
;; get-special-action: (syntax-object list) syntax-object syntax-object -> syntax-object
|
||
|
;; Returns the first action from a rule of the form ((which-special) action)
|
||
|
(define (get-special-action rules which-special none)
|
||
|
(cond
|
||
|
[(null? rules) none]
|
||
|
[else
|
||
|
(syntax-case (car rules) ()
|
||
|
[((special) ACT)
|
||
|
(and (identifier? #'special) (module-or-top-identifier=? #'special which-special))
|
||
|
#'ACT]
|
||
|
[_ (get-special-action (cdr rules) which-special none)])]))
|