Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Eliminate leftover quoting code; unused since Q.

  • Loading branch information...
commit 4925c91d7bdc94c473e72b60cc7fb2752cf1e662 1 parent 203f97e
Jonathan Worthington jnthn authored
Showing with 0 additions and 125 deletions.
  1. +0 −98 src/Perl6/Actions.pm
  2. +0 −27 src/Perl6/Grammar.pm
98 src/Perl6/Actions.pm
View
@@ -4893,104 +4893,6 @@ class Perl6::Actions is HLL::Actions does STDActions {
QAST::Op.new( :op('list'), |@*UNQUOTE_ASTS ));
}
- method quote_escape:sym<$>($/) {
- make steal_back_spaces($/, $<EXPR>.ast);
- }
-
- method quote_escape:sym<array>($/) {
- make steal_back_spaces($/, $<EXPR>.ast);
- }
-
- method quote_escape:sym<%>($/) {
- make steal_back_spaces($/, $<EXPR>.ast);
- }
-
- method quote_escape:sym<&>($/) {
- make steal_back_spaces($/, $<EXPR>.ast);
- }
-
- # Unfortunately, the operator precedence parser (probably correctly)
- # steals spaces after a postfixish. Thus "$a $b" would get messed up.
- # Here we take them back again. Hacky, better solutions welcome.
- sub steal_back_spaces($/, $expr) {
- my $pos := nqp::chars($/) - 1;
- while nqp::iscclass(32, $/, $pos) {
- $pos--;
- }
- my $nab_back := nqp::substr($/, $pos + 1);
- if $nab_back {
- QAST::Op.new( :op('call'), :name('&infix:<~>'), $expr, $*W.add_string_constant(~$nab_back) )
- }
- else {
- $expr
- }
- }
-
- method quote_escape:sym<{ }>($/) {
- make QAST::Op.new(
- :op('callmethod'), :name('Stringy'),
- QAST::Op.new(
- :op('call'),
- QAST::Op.new( :op('p6capturelex'), $<block>.ast ),
- :node($/)));
- }
-
- # overrides versions from HLL::Actions to use Perl 6 Str type
- # and use &infix:<,> to build the parcel
- method quote_EXPR($/) {
- if %*QUOTEMOD<ww> {
- make quote_words($/<quote_delimited>);
- }
- else {
- my $past := $<quote_delimited>.ast;
- if %*QUOTEMOD<w> {
- my @words := HLL::Grammar::split_words($/,
- compile_time_value_str($past, ":w list", $/));
- if +@words != 1 {
- $past := QAST::Op.new( :op('call'), :name('&infix:<,>'), :node($/) );
- for @words { $past.push($*W.add_string_constant(~$_)); }
- $past := QAST::Stmts.new($past);
- }
- else {
- $past := $*W.add_string_constant(~@words[0]);
- }
- }
- make $past;
- }
- }
-
- method quote_delimited($/) {
- my @parts;
- my str $lastlit := '';
- for $<quote_atom> {
- my $ast := $_.ast;
- if !($ast ~~ QAST::Node) {
- $lastlit := $lastlit ~ $ast;
- }
- elsif $ast.isa(QAST::SVal) {
- $lastlit := $lastlit ~ $ast.value;
- }
- else {
- if $lastlit gt '' {
- @parts.push($*W.add_string_constant($lastlit));
- }
- @parts.push(QAST::Op.new( :op('callmethod'), :name('Stringy'), $ast ));
- $lastlit := '';
- }
- }
- if $lastlit gt '' || !@parts {
- @parts.push($*W.add_string_constant($lastlit));
- }
- my $past := @parts ?? @parts.shift !! $*W.add_string_constant('');
- while @parts {
- $past := QAST::Op.new(
- :op('call'), :name('&infix:<~>'),
- $past, @parts.shift
- );
- }
- make $past;
- }
-
# Adds code to do the signature binding.
sub add_signature_binding_code($block, $sig_obj, @params) {
# Set arity.
27 src/Perl6/Grammar.pm
View
@@ -2585,33 +2585,6 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<block>
}
- token quote_escape:sym<$> {
- <?[$]>
- :my $*QSIGIL := '$';
- <?quotemod_check('s')>
- [ <EXPR('y=')> || <.panic: "Non-variable \$ must be backslashed"> ]
- }
-
- token quote_escape:sym<array> {
- <?[@]>
- :my $*QSIGIL := '@';
- <?quotemod_check('a')> <EXPR('y=')>
- }
-
- token quote_escape:sym<%> {
- <?[%]>
- :my $*QSIGIL := '%';
- <?quotemod_check('h')> <EXPR('y=')>
- }
-
- token quote_escape:sym<&> {
- <?[&]>
- :my $*QSIGIL := '&';
- <?quotemod_check('f')> <EXPR('y=')>
- }
-
- token quote_escape:sym<{ }> { <?[{]> <?quotemod_check('c')> <block> }
-
token circumfix:sym<( )> { :dba('parenthesized expression') '(' ~ ')' <semilist> }
token circumfix:sym<[ ]> { :dba('array composer') '[' ~ ']' <semilist> }
token circumfix:sym<ang> {
Please sign in to comment.
Something went wrong with that request. Please try again.