From be915f805dc15907f50100d9b9dc7ad29e197fb8 Mon Sep 17 00:00:00 2001 From: Carl Jackson Date: Wed, 11 Nov 2015 13:39:25 -0800 Subject: [PATCH] pattern: export Raw for retrieving original input This is in addition to the String method, which is oriented more towards human debugging. --- web/regexp_pattern.go | 4 ++++ web/string_pattern.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/web/regexp_pattern.go b/web/regexp_pattern.go index f9f8ecc..95e7e09 100644 --- a/web/regexp_pattern.go +++ b/web/regexp_pattern.go @@ -48,6 +48,10 @@ func (p regexpPattern) String() string { return fmt.Sprintf("regexpPattern(%v)", p.re) } +func (p regexpPattern) Raw() *regexp.Regexp { + return p.re +} + /* I'm sorry, dear reader. I really am. diff --git a/web/string_pattern.go b/web/string_pattern.go index 9e9945a..aa9b33a 100644 --- a/web/string_pattern.go +++ b/web/string_pattern.go @@ -90,6 +90,10 @@ func (s stringPattern) String() string { return fmt.Sprintf("stringPattern(%q)", s.raw) } +func (s stringPattern) Raw() string { + return s.raw +} + // "Break characters" are characters that can end patterns. They are not allowed // to appear in pattern names. "/" was chosen because it is the standard path // separator, and "." was chosen because it often delimits file extensions. ";"