diff --git a/macro-debugger-text-lib/macro-debugger/model/yacc-ext.rkt b/macro-debugger-text-lib/macro-debugger/model/yacc-ext.rkt index 8f51ce2..ceef3d2 100644 --- a/macro-debugger-text-lib/macro-debugger/model/yacc-ext.rkt +++ b/macro-debugger-text-lib/macro-debugger/model/yacc-ext.rkt @@ -19,7 +19,7 @@ (lambda (stx) (raise-syntax-error #f "definitions keyword used out of context" stx))) -(define-syntax (parser stx) +(define-syntax (parser* stx) (syntax-case stx () [(parser form ...) (let ([stop-list (list #'begin #'options #'productions #'definitions)] @@ -47,3 +47,10 @@ #'(let () def ... (#%expression (yacc:parser opt ... (grammar prod ...))))))])) + +(define-syntax-rule (parser . content) + ;; Ensure that local expansion doesn't add + ;; marks due to use of a macro in the enclosing + ;; binding scope: + (let () + (parser* . content))) diff --git a/macro-debugger-text-lib/macro-debugger/util/stxobj.rkt b/macro-debugger-text-lib/macro-debugger/util/stxobj.rkt index 95d7aad..c3c3a10 100644 --- a/macro-debugger-text-lib/macro-debugger/util/stxobj.rkt +++ b/macro-debugger-text-lib/macro-debugger/util/stxobj.rkt @@ -1,32 +1,8 @@ #lang racket/base -(require (rename-in racket/contract/base [-> c:->]) - ffi/unsafe) -(define lib (ffi-lib #f)) +(provide get-marks) -(define get-marks - (get-ffi-obj "scheme_stx_extract_marks" lib - (_fun _scheme -> _scheme))) - -#| -(define (simplify-marks marklist) - (simplify* (sort marklist <))) - -(define (simplify* marklist) - (cond [(null? marklist) marklist] - [(null? (cdr marklist)) marklist] - [(= (car marklist) (cadr marklist)) - (simplify* (cddr marklist))] - [else - (let ([result (simplify* (cdr marklist))]) - (if (eq? result (cdr marklist)) - marklist - (cons (car marklist) result)))])) - -(provide simplify-marks) -|# - -(provide/contract - [get-marks - ;; syntax? check needed for safety! - (c:-> syntax? any)]) +(define (get-marks stx) + (define info (syntax-debug-info stx)) + (for ([e (in-list (hash-ref info 'context))]) + (vector-ref e 0)))