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 @@ -818,3 +818,20 @@ type Type
818
818
end
819
819
end
820
820
@test method_exists (Mod18756. Type, ())
821
+
822
+ # Check qualified string macros
823
+ Base. r" regex" == r" regex"
824
+
825
+ module QualifiedStringMacro
826
+ module SubModule
827
+ macro x_str (x)
828
+ 1
829
+ end
830
+ macro y_cmd (x)
831
+ 2
832
+ end
833
+ end
834
+ end
835
+
836
+ @test QualifiedStringMacro. SubModule. x "" === 1
837
+ @test QualifiedStringMacro. SubModule. y `` === 2
You can’t perform that action at this time.
0 commit comments