Hello,
can anybody help me with this? Why does using tmprx result in an
error, but using tmp2rx works?
Top level
;;
> (fold (lambda (choice regexp)
(rx (| (submatch ,choice) ,regexp)))
(rx eos bos) ;; the regexp that never
;; matches anything
'("yes" "no"))
'#{Re-choice}
> (define tmprx ##)
> (regexp-search tmprx "yes")
Error: exception
wrong-type-argument
(checked-record-ref '#{Re-choice} '#{Record-type 48 re-seq} 1)
1> (define tmp2rx (rx ,tmprx))
1> (regexp-search tmp2rx "yes")
'#{regexp-match}
The match does not contain submatch informations, probably because the
regexp where included with , instead of ,@:
1> (define tmpmatch ##)
1> (match:substring tmpmatch 0)
"yes"
1> (match:substring tmpmatch 1)
Error: exception
(vector-ref '#(#{Match 0 3}) 1)
But using ,@ to include the regexps doesn't help either:
3> (fold (lambda (choice regexp)
(rx (| (submatch ,choice) ,@regexp)))
(rx eos bos) ;; the regexp that never
;; matches anything
'("yes" "no"))
'#{Re-choice}
3> (define tmpmatch ##)
3> (regexp-search tmprx "yes")
Error: exception
wrong-type-argument
(checked-record-ref '#{Re-choice} '#{Record-type 48 re-seq} 1)
Thank you for any hint.
Andreas.
PS:
Just in case this is a bug in scsh (which I don't believe), heres the
"scsh backtrace":
Top level
> (fold (lambda (choice regexp)
(rx (| (submatch ,choice) ,regexp)))
(rx eos bos) ;; the regexp that never
;; matches anything
'("yes" "no"))
'#{Re-choice}
> (define tmprx ##)
> (regexp-search tmprx "yes")
Error: exception
wrong-type-argument
(checked-record-ref '#{Re-choice} '#{Record-type 48 re-seq} 1)
1> ,debug
'#{Exception-continuation (pc 15) (re-seq:elts in re-level-0)}
[0: r##721] '#{Re-choice}
inspect: d
'#{Continuation (pc 32) (unnamed in recur in simp-choice1 ---)}
[0: elt] '#{Re-choice}
[1: pre-dsm] 0
[2: elt] '#{Re-choice}
[3: elts] '()
[4: elts] '(#{Re-choice})
[5: prev-cset] '#{:char-set}
[6: prev-bos?] #f
[7: prev-eos?] #f
[8: prev-bol?] #f
[9: prev-eol?] #f
[10: recur] '#{Procedure 9507 (recur in simp-choice1 in re-level-0)}
[11: elts] '(#{Re-submatch} #{Re-choice})
inspect: d
'#{Continuation (pc 365) (unnamed in recur in simp-choice1 ---)}
[0] '#{Procedure 9510 (unnamed in unnamed in recur ---)}
[1: elt] '#{Re-submatch}
[2: pre-dsm] 0
[3: elt] '#{Re-submatch}
[4: elts] '(#{Re-choice})
[5: elts] '(#{Re-submatch} #{Re-choice})
[6: prev-cset] '#{:char-set}
[7: prev-bos?] #f
[8: prev-eos?] #f
[9: prev-bol?] #f
[10: prev-eol?] #f
[11: recur] '#{Procedure 9507 (recur in simp-choice1 in re-level-0)}
[12: elts] '(#{Re-submatch} #{Re-choice})
inspect: d
'#{Continuation (pc 62) (simp-choice in re-level-0)}
[0] '#{Procedure 9516 (unnamed in simp-choice in re-level-0)}
[1: tsm] 1
[2: re] '#{Re-choice}
inspect: d
'#{Continuation (pc 57) (simplify-regexp in re-level-0)}
[0] '#{Procedure 9538 (unnamed in simplify-regexp in re-level-0)}
[1: re] '#{Re-choice}
inspect: d
'#{Continuation (pc 17) (regexp->posix-string in re-level-0)}
[0: re] '#{Re-choice}
inspect: d
'#{Continuation (pc 19) (compile in compile-regexp in re-level-0)}
[0] '#{Procedure 9498 (unnamed in compile in compile-regexp ---)}
[1: re] '#{Re-choice}
inspect: d
'#{Continuation (pc 36) (check-cache in compile-regexp in re-level-0)}
[0: temp##655] #f
[1: fetch] '#{Procedure 9729 (re-choice:posix in re-level-0)}
[2: set] '#{Procedure 9727 (set-re-choice:posix in re-level-0)}
[3: compile] '#{Procedure 9497 (compile in compile-regexp in re-level-0)}
[4: re] '#{Re-choice}
inspect: d
'#{Continuation (pc 50) (regexp-search in re-level-0)}
[0: mvec] '#(#f #f)
[1: tsm] 1
[2: re] '#{Re-choice}
[3: str] "yes"
[4: maybe-start] '()
inspect: d
'#{Continuation (pc 25) (evaluate-and-select in command-processor)}
[0] '#{Procedure 5931 (unnamed in evaluate-and-select in command-processor)}
[1] '(regexp-search tmprx "yes")
[2] '#{Package 176 user}
inspect:
pgpD7d227b3il.pgp
Description: PGP signature
|