[honu] allow already parsed expression to pass through

This commit is contained in:
Jon Rafkind 2011-08-30 18:31:55 -06:00
parent 050d0c0fe0
commit 5f0a221a03
3 changed files with 16 additions and 2 deletions

View File

@ -120,6 +120,13 @@
(loop (cons parsed used)
unparsed))))))
(define parsed-property (gensym 'honu-parsed))
(define (parsed-syntax syntax)
(syntax-property syntax parsed-property #t))
(define (parsed-syntax? syntax)
(syntax-property syntax parsed-property))
(define (stopper? what)
(define-literal-set check (honu-comma semicolon colon))
(define is (and (identifier? what)
@ -178,6 +185,8 @@
#'rest)
(do-parse #'rest precedence
left #'parsed)))))]
[(parsed-syntax? #'head)
(do-parse #'(rest ...) precedence left #'head)]
[(honu-operator? #'head)
(define new-precedence (transformer:honu-operator-ref (syntax-local-value #'head) 0))
(define association (transformer:honu-operator-ref (syntax-local-value #'head) 1))
@ -283,7 +292,10 @@
(error 'parse "function call")]
[else (error 'what "dont know how to parse ~a" #'head)])])])]))
(do-parse input 0 (lambda (x) x) #f))
(define-values (parsed unparsed)
(do-parse input 0 (lambda (x) x) #f))
(values (parsed-syntax parsed)
unparsed))
(define (empty-syntax? what)
(syntax-parse what

View File

@ -2,7 +2,6 @@
(provide (except-out (all-defined-out) test-delimiter))
(require "debug.rkt"
tests/eli-tester
racket/match
(for-syntax racket/base)
syntax/stx

View File

@ -3,3 +3,6 @@
macro testx () {x:expression} {syntax(x_result + 1)}
testx 5 * 2;
for z = 1 to testx 5 * 2 do
printf("z is ~a\n", z)