Author: particle
Date: Fri Jan  4 23:35:11 2008
New Revision: 24554

Modified:
   trunk/languages/perl6/perl6.pir

Log:
#49292: Make perl6 support -h
added usage text. try 'perl6 -h' today!

Modified: trunk/languages/perl6/perl6.pir
==============================================================================
--- trunk/languages/perl6/perl6.pir     (original)
+++ trunk/languages/perl6/perl6.pir     Fri Jan  4 23:35:11 2008
@@ -36,6 +36,16 @@
     $P1.'parsegrammar'('Perl6::Grammar')
     $P1.'parseactions'('Perl6::Grammar::Actions')
 
+    $P0 = new 'String'
+    $P0 = <<'    USAGE'
+    -h                   display help text
+    --target=[stage]     specify compilation stage to emit
+    -t, --trace=[flags]  enable trace flags
+    --encoding=[mode]    specify string encoding mode
+    -o, --output=[name]  specify name of output file
+    USAGE
+    setattribute $P1, '$usage', $P0
+
     ##  create a list for holding the stack of nested blocks
     $P0 = new 'List'
     set_hll_global ['Perl6';'Grammar';'Actions'], '@?BLOCK', $P0
@@ -94,6 +104,20 @@
 .end
 
 
+.sub 'usage' :method
+    .param string name     :optional
+    .param int    has_name :opt_flag
+
+    unless has_name goto got_name
+    name = 'perl6'
+  got_name:
+    print 'Usage: '
+    print name
+    $P0 = getattribute self, '$usage'
+    say $P0
+    exit 0
+.end
+
 .include 'src/gen_grammar.pir'
 .include 'src/parser/quote_expression.pir'
 .include 'src/gen_actions.pir'

Reply via email to