Changeset 21646
- Timestamp:
- 07/31/08 10:00:49 (5 months ago)
- Files:
-
- 6 modified
- 1 moved
-
src/perl6/Cursor.pmc (modified) (3 diffs)
-
src/perl6/STD.pm (modified) (19 diffs)
-
src/perl6/gimme5 (modified) (2 diffs)
-
src/perl6/try5 (modified) (3 diffs)
-
src/perl6/tryfile (modified) (1 diff)
-
t/spec/S02-literals/quoting.t (modified) (1 diff)
-
t/spec/S05-modifier/repetition-exhaustive.t (moved) (moved from t/spec/S05-modifier/repetition-exhausitve.t)
Legend:
- Unmodified
- Added
- Removed
-
src/perl6/Cursor.pmc
r21614 r21646 111 111 my $ext = ref($mixin) || $mixin; 112 112 push @newmix, $ext; 113 $ext =~ s/ ^.*:://; # just looking for a "cache" key, really114 $NEWWHAT .= '_ ' . $ext;113 $ext =~ s/(\w)\w*::/$1/g; # just looking for a "cache" key, really 114 $NEWWHAT .= '_X_' . $ext; 115 115 } 116 116 $self->deb("mixin $NEWWHAT from $WHAT @newmix") if $DEBUG & DEBUG::mixins; … … 687 687 my %r = %$self; 688 688 $r{_herelang} = $self; 689 bless \%r, ' Perl::Q';689 bless \%r, 'STD::Q'; 690 690 } 691 691 … … 771 771 delete $copy{_fate}; 772 772 delete $copy{_orig}; 773 my $text = Perl::Dump(\%copy);773 my $text = STD::Dump(\%copy); 774 774 $text =~ s/^\s*_(?:pos|orig):.*\n//mg; 775 775 $text; -
src/perl6/STD.pm
r21614 r21646 1 grammar Perl:ver<6.0.0.alpha>:auth<http://perl.org>;1 grammar STD:ver<6.0.0.alpha>:auth<http://perl.org>; 2 2 3 3 my $LANG is context; … … 392 392 \v :: 393 393 { $*LINE++ } 394 [ '#DEBUG -1' { say "DEBUG"; $ Perl::DEBUG = $*DEBUG = -1; } ]?394 [ '#DEBUG -1' { say "DEBUG"; $STD::DEBUG = $*DEBUG = -1; } ]? 395 395 } 396 396 … … 409 409 [ 410 410 <?after ^^ . > <.panic: "Can't use embedded comments in column 1"> 411 || <.quibble($¢.cursor_fresh( :: Perl::Q ))> {*} #= embedded411 || <.quibble($¢.cursor_fresh( ::STD::Q ))> {*} #= embedded 412 412 ] 413 413 | :: \N* {*} #= end … … 992 992 993 993 token postcircumfix:sym«< >» ( --> Methodcall) 994 { '<' <nibble($¢.cursor_fresh( :: Perl::Q ).tweak(:q).tweak(:w).balanced('<','>'))> [ '>' || <.panic: "Missing right angle quote"> ] }994 { '<' <nibble($¢.cursor_fresh( ::STD::Q ).tweak(:q).tweak(:w).balanced('<','>'))> [ '>' || <.panic: "Missing right angle quote"> ] } 995 995 996 996 token postcircumfix:sym«<< >>» ( --> Methodcall) 997 { '<<' <nibble($¢.cursor_fresh( :: Perl::Q ).tweak(:qq).tweak(:ww).balanced('<<','>>'))> [ '>>' || <.panic: "Missing right double-angle quote"> ] }997 { '<<' <nibble($¢.cursor_fresh( ::STD::Q ).tweak(:qq).tweak(:ww).balanced('<<','>>'))> [ '>>' || <.panic: "Missing right double-angle quote"> ] } 998 998 999 999 token postcircumfix:sym<« »> ( --> Methodcall) 1000 { '«' <nibble($¢.cursor_fresh( :: Perl::Q ).tweak(:qq).tweak(:ww).balanced('«','»'))> [ '»' || <.panic: "Missing right double-angle quote"> ] }1000 { '«' <nibble($¢.cursor_fresh( ::STD::Q ).tweak(:qq).tweak(:ww).balanced('«','»'))> [ '»' || <.panic: "Missing right double-angle quote"> ] } 1001 1001 1002 1002 token postop { … … 1697 1697 if $lang<_herelang> { 1698 1698 push @herestub_queue, 1699 Perl::Herestub.new(1699 STD::Herestub.new( 1700 1700 delim => $<nibble><nibbles>[0], 1701 1701 orignode => $¢, … … 1798 1798 1799 1799 1800 token quote:sym<' '> { "'" <nibble($¢.cursor_fresh( :: Perl::Q ).tweak(:q).unbalanced("'"))> "'" }1801 token quote:sym<" "> { '"' <nibble($¢.cursor_fresh( :: Perl::Q ).tweak(:qq).unbalanced('"'))> '"' }1802 1803 token quote:sym<« »> { '«' <nibble($¢.cursor_fresh( :: Perl::Q ).tweak(:qq).tweak(:ww).balanced('«','»'))> '»' }1804 token quote:sym«<< >>» { '<<' <nibble($¢.cursor_fresh( :: Perl::Q ).tweak(:qq).tweak(:ww).balanced('<<','>>'))> '>>' }1805 token quote:sym«< >» { '<' <nibble($¢.cursor_fresh( :: Perl::Q ).tweak(:q).tweak(:w).balanced('<','>'))> '>' }1800 token quote:sym<' '> { "'" <nibble($¢.cursor_fresh( ::STD::Q ).tweak(:q).unbalanced("'"))> "'" } 1801 token quote:sym<" "> { '"' <nibble($¢.cursor_fresh( ::STD::Q ).tweak(:qq).unbalanced('"'))> '"' } 1802 1803 token quote:sym<« »> { '«' <nibble($¢.cursor_fresh( ::STD::Q ).tweak(:qq).tweak(:ww).balanced('«','»'))> '»' } 1804 token quote:sym«<< >>» { '<<' <nibble($¢.cursor_fresh( ::STD::Q ).tweak(:qq).tweak(:ww).balanced('<<','>>'))> '>>' } 1805 token quote:sym«< >» { '<' <nibble($¢.cursor_fresh( ::STD::Q ).tweak(:q).tweak(:w).balanced('<','>'))> '>' } 1806 1806 1807 1807 token quote:sym</ /> { … … 1828 1828 'qq' 1829 1829 [ 1830 | <quote_mod> » <!before '('> { $qm = $<quote_mod>.text } <.ws> <quibble($¢.cursor_fresh( :: Perl::Q ).tweak(:qq).tweak($qm => 1))>1831 | » <!before '('> <.ws> <quibble($¢.cursor_fresh( :: Perl::Q ).tweak(:qq))>1830 | <quote_mod> » <!before '('> { $qm = $<quote_mod>.text } <.ws> <quibble($¢.cursor_fresh( ::STD::Q ).tweak(:qq).tweak($qm => 1))> 1831 | » <!before '('> <.ws> <quibble($¢.cursor_fresh( ::STD::Q ).tweak(:qq))> 1832 1832 ] 1833 1833 } … … 1836 1836 'q' 1837 1837 [ 1838 | <quote_mod> » <!before '('> { $qm = $<quote_mod>.text } <quibble($¢.cursor_fresh( :: Perl::Q ).tweak(:q).tweak($qm => 1))>1839 | » <!before '('> <.ws> <quibble($¢.cursor_fresh( :: Perl::Q ).tweak(:q))>1838 | <quote_mod> » <!before '('> { $qm = $<quote_mod>.text } <quibble($¢.cursor_fresh( ::STD::Q ).tweak(:q).tweak($qm => 1))> 1839 | » <!before '('> <.ws> <quibble($¢.cursor_fresh( ::STD::Q ).tweak(:q))> 1840 1840 ] 1841 1841 } … … 1845 1845 'Q' 1846 1846 [ 1847 | <quote_mod> » <!before '('> { $qm = $<quote_mod>.text } <quibble($¢.cursor_fresh( :: Perl::Q ).tweak($qm => 1))>1848 | » <!before '('> <.ws> <quibble($¢.cursor_fresh( :: Perl::Q ))>1847 | <quote_mod> » <!before '('> { $qm = $<quote_mod>.text } <quibble($¢.cursor_fresh( ::STD::Q ).tweak($qm => 1))> 1848 | » <!before '('> <.ws> <quibble($¢.cursor_fresh( ::STD::Q ))> 1849 1849 ] 1850 1850 } … … 1867 1867 1868 1868 token quote:s { 1869 <sym> » <!before '('> <pat=sibble( $¢.cursor_fresh( ::Regex ), $¢.cursor_fresh( :: Perl::Q ).tweak(:qq))>1869 <sym> » <!before '('> <pat=sibble( $¢.cursor_fresh( ::Regex ), $¢.cursor_fresh( ::STD::Q ).tweak(:qq))> 1870 1870 } 1871 1871 token quote:ss { 1872 <sym> » <!before '('> <pat=sibble( $¢.cursor_fresh( ::Regex ).tweak(:s), $¢.cursor_fresh( :: Perl::Q ).tweak(:qq))>1872 <sym> » <!before '('> <pat=sibble( $¢.cursor_fresh( ::Regex ).tweak(:s), $¢.cursor_fresh( ::STD::Q ).tweak(:qq))> 1873 1873 } 1874 1874 token quote:tr { 1875 <sym> » <!before '('> <pat=tribble( $¢.cursor_fresh( :: Perl::Q ).tweak(:q))>1875 <sym> » <!before '('> <pat=tribble( $¢.cursor_fresh( ::STD::Q ).tweak(:q))> 1876 1876 } 1877 1877 … … 2065 2065 } 2066 2066 2067 grammar Q is Perl{2068 2069 role b {2067 grammar Q is STD { 2068 2069 role b1 { 2070 2070 token escape:sym<\\> { <sym> <item=backslash> } 2071 2071 token backslash:qq { <?before 'q'> { $<quote> = $¢.cursor_fresh($+LANG).quote(); } } … … 2091 2091 } # end role 2092 2092 2093 role _b{2093 role b0 { 2094 2094 token escape:sym<\\> { <!> } 2095 2095 } # end role 2096 2096 2097 role c {2097 role c1 { 2098 2098 token escape:sym<{ }> { <?before '{'> [ :lang($+LANG) <block> ] } 2099 2099 } # end role 2100 2100 2101 role _c{2101 role c0 { 2102 2102 token escape:sym<{ }> { <!> } 2103 2103 } # end role 2104 2104 2105 role s {2105 role s1 { 2106 2106 token escape:sym<$> { <?before '$'> [ :lang($+LANG) <variable> <extrapost>? ] || <.panic: "Non-variable \$ must be backslashed"> } 2107 2107 token special_variable:sym<$"> { … … 2112 2112 } # end role 2113 2113 2114 role _s{2114 role s0 { 2115 2115 token escape:sym<$> { <!> } 2116 2116 token special_variable:sym<$"> { <!> } 2117 2117 } # end role 2118 2118 2119 role a {2119 role a1 { 2120 2120 token escape:sym<@> { <?before '@'> [ :lang($+LANG) <variable> <extrapost> | <!> ] } # trap ABORTBRANCH from variable's :: 2121 2121 } # end role 2122 2122 2123 role _a{2123 role a0 { 2124 2124 token escape:sym<@> { <!> } 2125 2125 } # end role 2126 2126 2127 role h {2127 role h1 { 2128 2128 token escape:sym<%> { <?before '%'> [ :lang($+LANG) <variable> <extrapost> | <!> ] } 2129 2129 } # end role 2130 2130 2131 role _h{2131 role h0 { 2132 2132 token escape:sym<%> { <!> } 2133 2133 } # end role 2134 2134 2135 role f {2135 role f1 { 2136 2136 token escape:sym<&> { <?before '&'> [ :lang($+LANG) <variable> <extrapost> | <!> ] } 2137 2137 } # end role 2138 2138 2139 role _f{2139 role f0 { 2140 2140 token escape:sym<&> { <!> } 2141 2141 } # end role 2142 2142 2143 role w {2143 role w1 { 2144 2144 method postprocess ($s) { $s.comb } 2145 2145 } # end role 2146 2146 2147 role _w{2147 role w0 { 2148 2148 method postprocess ($s) { $s } 2149 2149 } # end role 2150 2150 2151 role ww {2151 role ww1 { 2152 2152 method postprocess ($s) { $s.comb } 2153 2153 } # end role 2154 2154 2155 role x { 2155 role ww0 { 2156 method postprocess ($s) { $s } 2157 } # end role 2158 2159 role x1 { 2156 2160 method postprocess ($s) { $s.run } 2157 2161 } # end role 2158 2162 2159 role _x{2163 role x0 { 2160 2164 method postprocess ($s) { $s } 2161 2165 } # end role … … 2180 2184 } # end role 2181 2185 2182 role qq does b does c does s does a does h does f{2186 role qq does b1 does c1 does s1 does a1 does h1 does f1 { 2183 2187 token stopper { \" } 2184 2188 # in double quotes, omit backslash on random \W backslash by default … … 2210 2214 multi method tweak (:double(:$qq)) { self.truly($qq, ':qq'); self.mixin( ::qq ); } 2211 2215 2212 multi method tweak (:backslash(:$b)) { self.mixin($b ?? ::b !! ::_b) }2213 multi method tweak (:scalar(:$s)) { self.mixin($s ?? ::s !! ::_s) }2214 multi method tweak (:array(:$a)) { self.mixin($a ?? ::a !! ::_a) }2215 multi method tweak (:hash(:$h)) { self.mixin($h ?? ::h !! ::_h) }2216 multi method tweak (:function(:$f)) { self.mixin($f ?? ::f !! ::_f) }2217 multi method tweak (:closure(:$c)) { self.mixin($c ?? ::c !! ::_c) }2218 2219 multi method tweak (:exec(:$x)) { self.mixin($x ?? ::x !! ::_x) }2220 multi method tweak (:words(:$w)) { self.mixin($w ?? ::w !! ::_w) }2221 multi method tweak (:quotewords(:$ww)) { self.mixin($ww ?? ::ww !! ::_ww) }2216 multi method tweak (:backslash(:$b)) { self.mixin($b ?? ::b1 !! ::b0) } 2217 multi method tweak (:scalar(:$s)) { self.mixin($s ?? ::s1 !! ::s0) } 2218 multi method tweak (:array(:$a)) { self.mixin($a ?? ::a1 !! ::a0) } 2219 multi method tweak (:hash(:$h)) { self.mixin($h ?? ::h1 !! ::h0) } 2220 multi method tweak (:function(:$f)) { self.mixin($f ?? ::f1 !! ::f0) } 2221 multi method tweak (:closure(:$c)) { self.mixin($c ?? ::c1 !! ::c0) } 2222 2223 multi method tweak (:exec(:$x)) { self.mixin($x ?? ::x1 !! ::x0) } 2224 multi method tweak (:words(:$w)) { self.mixin($w ?? ::w1 !! ::w0) } 2225 multi method tweak (:quotewords(:$ww)) { self.mixin($ww ?? ::ww1 !! ::ww0) } 2222 2226 2223 2227 multi method tweak (:heredoc(:$to)) { self.truly($to, ':to'); self.cursor_herelang; } … … 2853 2857 <sym> 2854 2858 { $¢ = (self.<sigil>//'') eq '$' 2855 ?? Perl::Item_assignment.coerce($¢)2856 !! Perl::List_assignment.coerce($¢);2859 ?? STD::Item_assignment.coerce($¢) 2860 !! STD::List_assignment.coerce($¢); 2857 2861 } 2858 2862 } … … 2925 2929 2926 2930 # unrecognized identifiers are assumed to be post-declared listops. 2927 # (XXX for cheating purposes this rule must be the last term: rule) 2928 token term:name ( --> List_prefix) 2931 token term:ident ( --> Term ) 2932 { 2933 <ident> 2934 [ 2935 | '.(' <semilist> [ ')' || <.panic: "Missing right parenthesis"> ] {*} #= func args 2936 | '(' <semilist> [ ')' || <.panic: "Missing right parenthesis"> ] {*} #= func args 2937 | <.unsp> '.'? '(' <semilist> [ ')' || <.panic: "Missing right parenthesis"> ] {*} #= func args 2938 ] 2939 } 2940 2941 token term:name ( --> Term) 2929 2942 { 2930 2943 <longname> :: … … 3239 3252 ################################################# 3240 3253 3241 grammar Regex is Perl{3254 grammar Regex is STD { 3242 3255 3243 3256 # begin tweaks (DO NOT ERASE) 3244 multi method tweak (:Perl5(:$P5)) { self.cursor_fresh( :: Perl::Q ).mixin( ::p5 ) }3257 multi method tweak (:Perl5(:$P5)) { self.cursor_fresh( ::STD::Q ).mixin( ::p5 ) } 3245 3258 multi method tweak (:overlap(:$ov)) { self } 3246 3259 multi method tweak (:exhaustive(:$ex)) { self } … … 3536 3549 [ 3537 3550 | <name> 3538 | <before '['> <quibble($¢.cursor_fresh( :: Perl::Q ).tweak(:q))> # XXX parse as q[] for now3551 | <before '['> <quibble($¢.cursor_fresh( ::STD::Q ).tweak(:q))> # XXX parse as q[] for now 3539 3552 ] 3540 3553 } -
src/perl6/gimme5
r21605 r21646 41 41 our $NEEDORIGARGS; 42 42 our $PKG = "main"; 43 our $TOP = " Perl";43 our $TOP = "STD"; 44 44 our @PKG = (); 45 45 our $ALTNAME; … … 256 256 END 257 257 258 $out .= <<'END' if $TOP eq ' Perl';258 $out .= <<'END' if $TOP eq 'STD'; 259 259 $self->_AUTOLEXpeek('termish',$retree); 260 system('cp lex/ Perl/termish lex/Perl/EXPR');260 system('cp lex/STD/termish lex/STD/EXPR'); 261 261 END 262 262 -
src/perl6/try5
r21274 r21646 42 42 } 43 43 } 44 #my $cmd = qq/perl -w -I . -MSTD5 -e 'print Perl::Dump(Perl->new(orig=>$input)->${rule}(["$rule"]));'/;44 #my $cmd = qq/perl -w -I . -MSTD5 -e 'print STD::Dump(STD->new(orig=>$input)->${rule}(["$rule"]));'/; 45 45 #warn "# ",$cmd,"\n"; 46 46 #system "$cmd 2>try5.err"; … … 48 48 require "STD.pmc"; 49 49 my $err = "try5.err"; 50 my $perl = Perl->new($input);50 my $perl = STD->new($input); 51 51 if(!$perl->can($rule)) { die "\nERROR: Unknown rule: $rule\n"; } 52 52 open(STDERR,">$err") or die; … … 54 54 if($result) { 55 55 print $result->dump(); 56 # print Perl::Dump($result);56 # print STD::Dump($result); 57 57 } else { 58 58 print "Parse failed. See $err.\n"; -
src/perl6/tryfile
r21464 r21646 10 10 my $what = 'comp_unit'; 11 11 my $text = Encode::decode('utf8', `cat $file`); 12 my $r = Perl->new($text)->$what();12 my $r = STD->new($text)->$what(); 13 13 print Dump($r); -
t/spec/S02-literals/quoting.t
r21547 r21646 504 504 sub zeta {42}; 505 505 506 is(qw (a b), <a b>, 'qw');507 is(qww ($alpha $beta), <foo bar>, 'qww');508 is(qq ($alpha $beta), 'foo bar', 'qq');509 is(Qs ($alpha @delta[] %gamma<>), 'foo @delta %gamma', 'Qs');510 is(Qa ($alpha @delta[] %gamma<>), '$alpha ' ~ @delta ~ ' %gamma', 'Qa');511 is(Qh ($alpha @delta[] %gamma<>), '$alpha @delta ' ~ %gamma, 'Qh');512 is(Qf ($alpha &zeta()), '$alpha 42', 'Qf');513 is(Qb ($alpha\t$beta), '$alpha $beta', 'Qb');514 is(Qc ({1+1}), 2, 'Qc');515 } 516 506 is(qw[a b], <a b>, 'qw'); 507 is(qww[$alpha $beta], <foo bar>, 'qww'); 508 is(qq[$alpha $beta], 'foo bar', 'qq'); 509 is(Qs[$alpha @delta[] %gamma<>], 'foo @delta %gamma', 'Qs'); 510 is(Qa[$alpha @delta[] %gamma<>], '$alpha ' ~ @delta ~ ' %gamma', 'Qa'); 511 is(Qh[$alpha @delta[] %gamma<>], '$alpha @delta ' ~ %gamma, 'Qh'); 512 is(Qf[$alpha &zeta()], '$alpha 42', 'Qf'); 513 is(Qb[$alpha\t$beta], '$alpha $beta', 'Qb'); 514 is(Qc[{1+1}], 2, 'Qc'); 515 } 516
