File tree 2 files changed +25
-6
lines changed
2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 1067
1067
(take-token s)
1068
1068
(loop (list* 'curly ex (parse-arglist s #\} ))))
1069
1069
((#\" #\` )
1070
- (if (and (symbol? ex) (not (operator? ex))
1070
+ (if (and (or (symbol? ex) (valid-modref? ex))
1071
+ (not (operator? ex))
1071
1072
(not (ts:space? s)))
1072
1073
; ; custom string and command literals; x"s" => @x_str "s"
1073
1074
(let* ((macstr (begin (take-token s)
1074
1075
(parse-raw-literal s t)))
1075
1076
(nxt (peek-token s))
1076
- (macname (symbol (string #\@ ex (macsuffix t) ))))
1077
+ (macname (macroify-name ex (macsuffix t))))
1077
1078
(if (and (symbol? nxt) (not (operator? nxt))
1078
1079
(not (ts:space? s)))
1079
1080
; ; string literal suffix, "s"x
2060
2061
(or (symbol? (cadr e))
2061
2062
(valid-modref? (cadr e)))))
2062
2063
2063
- (define (macroify-name e )
2064
- (cond ((symbol? e) (symbol (string #\@ e)))
2065
- ((valid-modref? e) `(|.| ,(cadr e)
2066
- (quote ,(macroify-name (cadr (caddr e))) )))
2064
+ (define (macroify-name e . suffixes )
2065
+ (cond ((symbol? e) (symbol (apply string #\@ e suffixes)))
2066
+ ((valid-modref? e)
2067
+ `(|.| ,(cadr e)
2068
+ (quote ,(apply macroify-name (cadr (caddr e)) suffixes) )))
2067
2069
(else (error (string " invalid macro use \" @(" (deparse e) " )\" " )))))
2068
2070
2069
2071
(define (simple-string-literal? e ) (string? e))
Original file line number Diff line number Diff line change 807
807
``` . head == :if
808
808
809
809
end
810
+
811
+ # Check qualified string macros
812
+ Base. r" regex" == r" regex"
813
+
814
+ module QualifiedStringMacro
815
+ module SubModule
816
+ macro x_str (x)
817
+ 1
818
+ end
819
+ macro y_cmd (x)
820
+ 2
821
+ end
822
+ end
823
+ end
824
+
825
+ @test QualifiedStringMacro. SubModule. x "" === 1
826
+ @test QualifiedStringMacro. SubModule. y `` === 2
You can’t perform that action at this time.
0 commit comments