Skip to content
This repository
Browse code

Perlito5 - command-line option -B is now default

  • Loading branch information...
commit 5ef57bb4dd4c88174637b1098f604d2d48f54367 1 parent 39026fb
Flavio S. Glock authored April 12, 2012
14  ChangeLog
... ...
@@ -1,3 +1,17 @@
  1
+dev  2012-04-12
  2
+
  3
+* Perlito5 (Perl 5 compiler):
  4
+
  5
+- parser:
  6
+
  7
+-- autoquote hash-keys fix
  8
+-- option "-B" is now the default; this executes immediately:  perlito5 -e 'say "ok"'
  9
+
  10
+
  11
+* Perlito6 (Perl 6 compiler):
  12
+
  13
+
  14
+
1 15
 9.0  2012-04-11
2 16
 
3 17
 * Perlito5 (Perl 5 compiler):
15  perlito5.pl
@@ -23,8 +23,8 @@ package Perlito;
23 23
 ((my  $_V5_COMPILER_NAME) = 'Perlito5');
24 24
 ((my  $_V5_COMPILER_VERSION) = '9.0');
25 25
 ((my  $source) = '');
26  
-((my  $backend) = '');
27  
-((my  $execute) = 0);
  26
+((my  $backend) = $main::^O);
  27
+((my  $execute) = 1);
28 28
 ((my  $verbose) = 0);
29 29
 ((my  $expand_use) = 1);
30 30
 if ($verbose) {
@@ -49,12 +49,7 @@ package Perlito;
49 49
     }
50 50
 };
51 51
 if ((substr($ARGV[0], 0, 2) eq '-B')) {
52  
-    ($backend = substr($ARGV[0], 2, 10));
53  
-    ($execute = 1);
54  
-    shift(@ARGV);
55  
-    if ((((($backend eq 'perl5') || ($backend eq 'python')) || ($backend eq 'ruby')) || ($backend eq 'js'))) {
56  
-        ($expand_use = 0)
57  
-    }
  52
+    shift(@ARGV)
58 53
 };
59 54
 if (((($ARGV[0] eq '-V')) || (($ARGV[0] eq '--version')))) {
60 55
     ($backend = '');
@@ -62,9 +57,9 @@ package Perlito;
62 57
     shift(@ARGV)
63 58
 }
64 59
 else {
65  
-    if ((((($ARGV[0] eq '-h')) || (($ARGV[0] eq '--help'))) || (($backend eq '')))) {
  60
+    if (((($ARGV[0] eq '-h') || ($ARGV[0] eq '--help')) || !(@ARGV))) {
66 61
         ($backend = '');
67  
-        Perlito5::Runtime::say($_V5_COMPILER_NAME, ' ', $_V5_COMPILER_VERSION, chr(10) . 'perlito5 [switches] [programfile]' . chr(10) . '  switches:' . chr(10) . '    -h --help' . chr(10) . '    -v --verbose' . chr(10) . '    -V --version' . chr(10) . '    -Idirectory     specify @INC/include directory (several -I' . chr(39) . 's allowed)' . chr(10) . '    -Ctarget        target backend: js, perl5, perl6' . chr(10) . '    -Cast-perl5     emits a dump of the abstract syntax tree' . chr(10) . '    -Btarget        execute using the backend: js' . chr(10) . '    --expand_use --noexpand_use' . chr(10) . '                    expand ' . chr(39) . 'use' . chr(39) . ' statements at compile time' . chr(10) . '    -e program      one line of program (omit programfile)' . chr(10));
  62
+        Perlito5::Runtime::say($_V5_COMPILER_NAME, ' ', $_V5_COMPILER_VERSION, chr(10) . 'perlito5 [switches] [programfile]' . chr(10) . '  switches:' . chr(10) . '    -h --help' . chr(10) . '    -v --verbose' . chr(10) . '    -V --version' . chr(10) . '    -Idirectory     specify @INC/include directory (several -I' . chr(39) . 's allowed)' . chr(10) . '    -Ctarget        target backend: js, perl5, perl6' . chr(10) . '    -Cast-perl5     emits a dump of the abstract syntax tree' . chr(10) . '    --expand_use --noexpand_use' . chr(10) . '                    expand ' . chr(39) . 'use' . chr(39) . ' statements at compile time' . chr(10) . '    -e program      one line of program (omit programfile)' . chr(10));
68 63
         shift(@ARGV)
69 64
     }
70 65
 };
18  src5/util/perlito5.pl
@@ -23,8 +23,8 @@ package Perlito;
23 23
 my $_V5_COMPILER_NAME    = 'Perlito5';
24 24
 my $_V5_COMPILER_VERSION = '9.0';
25 25
 my $source      = '';
26  
-my $backend     = '';
27  
-my $execute     = 0;
  26
+my $backend     = $^O;
  27
+my $execute     = 1;
28 28
 my $verbose     = 0;
29 29
 my $expand_use  = 1;
30 30
 
@@ -56,24 +56,15 @@ package Perlito;
56 56
     }
57 57
 }
58 58
 if (substr($ARGV[0], 0, 2) eq '-B') {
59  
-    $backend = substr($ARGV[0], 2, 10);
60  
-    $execute = 1;
  59
+    # obsolete option, "execute" is now default
61 60
     shift @ARGV;
62  
-    if (  $backend eq 'perl5'
63  
-       || $backend eq 'python'
64  
-       || $backend eq 'ruby'
65  
-       || $backend eq 'js'
66  
-       )
67  
-    {
68  
-        $expand_use = 0;
69  
-    }
70 61
 }
71 62
 if (($ARGV[0] eq '-V') || ($ARGV[0] eq '--version')) {
72 63
     $backend = '';
73 64
     say $_V5_COMPILER_NAME, " ", $_V5_COMPILER_VERSION;
74 65
     shift @ARGV;
75 66
 }
76  
-elsif (($ARGV[0] eq '-h') || ($ARGV[0] eq '--help') || ($backend eq '')) {
  67
+elsif ($ARGV[0] eq '-h' || $ARGV[0] eq '--help' || !@ARGV) {
77 68
     $backend = '';
78 69
     say $_V5_COMPILER_NAME, " ", $_V5_COMPILER_VERSION, "
79 70
 perlito5 [switches] [programfile]
@@ -84,7 +75,6 @@ package Perlito;
84 75
     -Idirectory     specify \@INC/include directory (several -I's allowed)
85 76
     -Ctarget        target backend: js, perl5, perl6
86 77
     -Cast-perl5     emits a dump of the abstract syntax tree
87  
-    -Btarget        execute using the backend: js
88 78
     --expand_use --noexpand_use
89 79
                     expand 'use' statements at compile time
90 80
     -e program      one line of program (omit programfile)

0 notes on commit 5ef57bb

Please sign in to comment.
Something went wrong with that request. Please try again.