From a8e7242f1b486cd441fd93c63b965940372e22a6 Mon Sep 17 00:00:00 2001 From: sorear Date: Sun, 29 Aug 2010 21:37:58 +0000 Subject: [PATCH] [std] Fold setting-compiler functionality into viv; remove in favor of tryfile git-svn-id: http://svn.pugscode.org/pugs@32110 c213334d-75ef-0310-aa23-eaa082d1ae64 --- src/perl6/Makefile | 6 ++-- src/perl6/std | 89 ------------------------------------------------------ src/perl6/viv | 11 +++++-- 3 files changed, 12 insertions(+), 94 deletions(-) delete mode 100755 src/perl6/std diff --git a/src/perl6/Makefile b/src/perl6/Makefile index 26a279438..8e49feb1c 100644 --- a/src/perl6/Makefile +++ b/src/perl6/Makefile @@ -2,7 +2,7 @@ .PHONY: six all sixfast clean snap snaptest INVARIANT=Actions.pm CORE.setting CursorBase.pmc DEBUG.pmc LazyMap.pm NAME.pmc\ - RE_ast.pmc Stash.pmc mangle.pl std uniprops viv + RE_ast.pmc Stash.pmc mangle.pl uniprops viv GENERATE=STD.pmc Cursor.pmc BOOTFILES=boot/STD.pmc boot/Cursor.pmc @@ -33,7 +33,7 @@ clean: # */syml/CORE.syml indicates that the corresponding compiler is "usable" boot/syml/CORE.syml: $(INVARIANT) $(BOOTFILES) $(RM_RF) boot/syml - $(PERL) std --boot $(STDINC) CORE.setting + $(PERL) viv --boot $(STDINC) --compile-setting CORE.setting STD.pmc: $(STD_SOURCE) boot/syml/CORE.syml $(INVARIANT) $(PERL) viv --boot $(STDINC) -5 -o STD.pm5 STD.pm6 @@ -46,7 +46,7 @@ Cursor.pmc: $(CURSOR_SOURCE) boot/syml/CORE.syml $(INVARIANT) $(PERL) tools/compact_pmc < Cursor.pm5 > Cursor.pmc syml/CORE.syml: STD.pmc Cursor.pmc $(INVARIANT) $(RM_RF) syml - $(PERL) std $(STDINC) CORE.setting + $(PERL) viv $(STDINC) --compile-setting CORE.setting reboot: six $(CP) $(GENERATE) boot diff --git a/src/perl6/std b/src/perl6/std deleted file mode 100755 index d5165ce4b..000000000 --- a/src/perl6/std +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env perl - -BEGIN { - use FindBin; - use File::Spec; - unshift @INC, $FindBin::Bin; - if (@ARGV >= 1 && $ARGV[0] eq '--boot') { - shift @ARGV; - unshift @INC, File::Spec->catdir($FindBin::Bin, "boot"); - $CursorBase::SET_STD5PREFIX = "boot"; - } - if (@ARGV >= 1 && $ARGV[0] eq '--clear-inc') { - $CursorBase::SET_PERL6LIB = [ ]; - shift @ARGV; - } - while (@ARGV >= 2 && $ARGV[0] eq '--inc') { - push @$CursorBase::SET_PERL6LIB, $ARGV[1]; - splice @ARGV, 0, 2; - } -} - -use STD; -use utf8; - -use Actions; - -my $failures = 0; - -@ARGV = 'CORE.setting' unless @ARGV; - -for my $file (@ARGV) { - warn $file,"\n" if @ARGV > 1; - my $setting = "CORE"; - $setting = "NULL" if $file eq 'CORE.setting'; - my $r; - eval { - $r = STD->parsefile($file, setting => $setting, actions => 'Actions')->{'_ast'}; - }; - if ($@) { - warn $@; - $failures++; - } -} -my ($time, $vsz) = split(' ', `ps -o "time= vsz=" $$`); -$time =~ s/^00://; -$vsz =~ s/\d\d\d$/m/; -if ($failures) { - if ($vsz) { - warn "std FAILED $time $vsz @ARGV\n"; - } - else { - warn "std FAILED @ARGV\n"; - } - exit $failures; -} -elsif ($vsz) { - warn "ok $time $vsz @ARGV\n"; -} -else { - warn "ok @ARGV\n"; -} - -{ package VAST::Additive; } -{ package VAST::Autoincrement; } -{ package VAST::Base; } -{ package VAST::Chaining; } -{ package VAST::Comma; } -{ package VAST::Concatenation; } -{ package VAST::Conditional; } -{ package VAST::Exponentiation; } -{ package VAST::Item_assignment; } -{ package VAST::Junctive_and; } -{ package VAST::Junctive_or; } -{ package VAST::List_assignment; } -{ package VAST::List_infix; } -{ package VAST::List_prefix; } -{ package VAST::Loose_and; } -{ package VAST::Loose_or; } -{ package VAST::Loose_unary; } -{ package VAST::Methodcall; } -{ package VAST::Multiplicative; } -{ package VAST::Named_unary; } -{ package VAST::Replication; } -{ package VAST::Sequencer; } -{ package VAST::Structural_infix; } -{ package VAST::Symbolic_unary; } -{ package VAST::Term; } -{ package VAST::Tight_and; } -{ package VAST::Tight_or; } diff --git a/src/perl6/viv b/src/perl6/viv index a787d2d14..f66648198 100755 --- a/src/perl6/viv +++ b/src/perl6/viv @@ -59,6 +59,7 @@ our $OPT_log = 0; our $OPT_stab = 0; our $OPT_thaw = 0; our $OPT_keep_going = 0; +our $OPT_compile_setting = 0; our $OPT_output_file = undef; my $PROG = ''; our $ORIG; @@ -140,6 +141,7 @@ my $r = GetOptions( "match|m" => \$OPT_match, "thaw" => \$OPT_thaw, "keep-going|k" => \$OPT_keep_going, + "compile-setting=s" => \$OPT_compile_setting, "help" => sub { USAGE() } ); @@ -4188,6 +4190,11 @@ END } unless (caller) { + if ($OPT_compile_setting) { + STD->parsefile($OPT_compile_setting, setting => "NULL"); + exit 0; + } + USAGE() unless @ARGV || $PROG; my $r; if ($OPT_thaw) { @@ -4199,8 +4206,8 @@ unless (caller) { Actions::gen_class($cl, $raw->{GENCLASS}->{$cl}); } } - elsif (@_ and -f $_[0]) { - $r = STD->parsefile($_[0], text_return => \$ORIG, + elsif (@ARGV and -f $ARGV[0]) { + $r = STD->parsefile($ARGV[0], text_return => \$ORIG, actions => 'Actions')->{'_ast'}; } else { -- 2.11.4.GIT