Permalink
Browse files

Add support for short-form Q strings.

You should now be able to type out your Q-based strings as 「...」,
similar to '...' and "...".
  • Loading branch information...
1 parent 7b43e38 commit 8b435d3860837559a40cd317b5dd823b7bd6b621 @ShimmerFairy ShimmerFairy committed Feb 22, 2014
Showing with 2 additions and 0 deletions.
  1. +1 −0 src/Perl6/Actions.nqp
  2. +1 −0 src/Perl6/Grammar.nqp
View
@@ -5593,6 +5593,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
method quote:sym<apos>($/) { make $<nibble>.ast; }
method quote:sym<dblq>($/) { make $<nibble>.ast; }
+ method quote:sym<crnr>($/) { make $<nibble>.ast; }
method quote:sym<qq>($/) { make $<quibble>.ast; }
method quote:sym<q>($/) { make $<quibble>.ast; }
method quote:sym<Q>($/) { make $<quibble>.ast; }
View
@@ -2956,6 +2956,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
proto token quote { <...> }
token quote:sym<apos> { :dba('single quotes') "'" ~ "'" <nibble(self.quote_lang(%*LANG<Q>, "'", "'", ['q']))> }
token quote:sym<dblq> { :dba('double quotes') '"' ~ '"' <nibble(self.quote_lang(%*LANG<Q>, '"', '"', ['qq']))> }
+ token quote:sym<crnr> { :dba('corner quotes') '「' ~ '」' <nibble(self.quote_lang(%*LANG<Q>, '', ''))> }
token quote:sym<q> {
:my $qm;
'q'

2 comments on commit 8b435d3

Member

FROGGS replied Feb 27, 2014

We should replace the corner brackets by their \x code because otherwise the setting parse time increases insanely.
U+FF62 HALFWIDTH LEFT CORNER BRACKET [Ps] (「)
U+FF63 HALFWIDTH RIGHT CORNER BRACKET [Pe] (」)

Member

FROGGS replied Feb 28, 2014

Okay, I've benchmarked it with and without these corner brackets, and there is no difference in compiling Grammar.pm or parsing the setting. (tested on all three backends)

Please sign in to comment.