Skip to content

Commit efd2de0

Browse files
committed
allow smart quotes
1 parent f9b7f55 commit efd2de0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

STD.pm6

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,9 @@ token quotepair {
590590

591591
token quote:sym<「 」> { :dba('perfect quotes') "「" ~ "」" <nibble($¢.cursor_fresh( %*LANG<Q> ).unbalanced(""))> }
592592
token quote:sym<' '> { :dba('single quotes') "'" ~ "'" <nibble($¢.cursor_fresh( %*LANG<Q> ).tweak(:q).unbalanced("'"))> }
593+
token quote:sym<‘ ’> { :dba('single quotes') "‘" ~ "’" <nibble($¢.cursor_fresh( %*LANG<Q> ).tweak(:q).unbalanced(""))> }
593594
token quote:sym<" "> { :dba('double quotes') '"' ~ '"' <nibble($¢.cursor_fresh( %*LANG<Q> ).tweak(:qq).unbalanced('"'))> }
595+
token quote:sym<“ ”> { :dba('double quotes') '“' ~ '”' <nibble($¢.cursor_fresh( %*LANG<Q> ).tweak(:qq).unbalanced(''))> }
594596

595597
token circumfix:sym<« »> { :dba('shell-quote words') '«' ~ '»' <nibble($¢.cursor_fresh( %*LANG<Q> ).tweak(:qq).tweak(:ww).balanced('«','»'))> }
596598
token circumfix:sym«<< >>» { :dba('shell-quote words') '<<' ~ '>>' <nibble($¢.cursor_fresh( %*LANG<Q> ).tweak(:qq).tweak(:ww).balanced('<<','>>'))> }
@@ -4867,7 +4869,7 @@ grammar Regex is STD {
48674869
<?before \s | '#'> [ :lang(%*LANG<MAIN>) <.ws> ]
48684870
}
48694871

4870-
token unsp { '\\' <?before \s | '#'> <.panic: "No unspace allowed in regex; if you meant to match the literal character, please enclose in single quotes ('" ~ substr(self.orig,$¢.pos,1) ~ "') or use a backslashed form like \\x" ~ sprintf('%02x', ord(substr(self.orig,$¢.pos,1)))> } # no unspace in regexen
4872+
token unsp { '\\' <?before \s> <.panic: "No unspace allowed in regex; if you meant to match the literal character, please enclose in single quotes ('" ~ substr(self.orig,$¢.pos,1) ~ "') or use a backslashed form like \\x" ~ sprintf('%02x', ord(substr(self.orig,$¢.pos,1)))> } # no unspace in regexen
48714873

48724874
rule nibbler {
48734875
:temp %*RX;
@@ -5075,7 +5077,9 @@ grammar Regex is STD {
50755077

50765078
token metachar:sym<「 」> { <?before "「"> [:lang(%*LANG<MAIN>) <quote>] <.SIGOK> }
50775079
token metachar:sym<' '> { <?before "'"> [:lang(%*LANG<MAIN>) <quote>] <.SIGOK> }
5080+
token metachar:sym<‘ ’> { <?before "‘"> [:lang(%*LANG<MAIN>) <quote>] <.SIGOK> }
50785081
token metachar:sym<" "> { <?before '"'> [:lang(%*LANG<MAIN>) <quote>] <.SIGOK> }
5082+
token metachar:sym<“ ”> { <?before '“'> [:lang(%*LANG<MAIN>) <quote>] <.SIGOK> }
50795083

50805084
token metachar:var {
50815085
:my $*QSIGIL ::= substr(self.orig,self.pos,1);

0 commit comments

Comments
 (0)