Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Reimagine cursor_herelang as mixing in a role
  • Loading branch information
sorear committed Oct 16, 2010
1 parent 32cdb76 commit 9b64deb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions v6/STD.pm6
Expand Up @@ -755,6 +755,8 @@ method heredoc () {
return self.cursor($here.pos); # return to initial type
}

method herelang () { Any }

token quibble ($l) {
:my ($lang, $start, $stop);
<babble($l)>
Expand All @@ -763,12 +765,12 @@ token quibble ($l) {
$start <nibble($lang)> [ $stop || <.panic: "Couldn't find terminator $stop"> ]

{
if $lang<_herelang> {
if $lang.herelang {
push @herestub_queue,
Herestub.new(
delim => $<nibble><nibbles>[0]<TEXT>,
orignode => $¢,
lang => $lang<_herelang>,
lang => $lang.herelang,
);
}
}
Expand Down Expand Up @@ -4326,6 +4328,9 @@ grammar Q is STD {
}
}

role herehead[$lang] {
method herelang() { $lang }
}

method tweak(:single(:$q), :double(:$qq), :cclass(:$cc), :backslash(:$b),
:scalar(:$s), :array(:$a), :hash(:$h), :function(:$f),
Expand All @@ -4349,7 +4354,7 @@ grammar Q is STD {
elsif $w.defined { self.mixin($w ?? STD::Q::w1 !! STD::Q::w0) }
elsif $ww.defined { self.mixin($ww ?? STD::Q::ww1 !! STD::Q::ww0) }

elsif $to.defined { self.truly($to, ':to'); self.cursor_herelang }
elsif $to.defined { self.truly($to, ':to'); STD::Q.mixin(STD::Q::herehead[self]) }

elsif $regex.defined {
%*LANG<Regex>
Expand Down
1 change: 0 additions & 1 deletion v6/TODO
Expand Up @@ -3,7 +3,6 @@ Cursor.canonicalize_name
Cursor.check_old_cclass
Cursor.cursor_all
Cursor.cursor_fresh
Cursor.cursor_herelang
Cursor.do_import
Cursor.do_use
Cursor.gettrait
Expand Down

0 comments on commit 9b64deb

Please sign in to comment.