Commits

Anonymous committed 3ab8807

exeunt omnes

  • Participants
  • Parent commits 128c853

Comments (0)

Files changed (16)

File src/builtins/say.pir

     $P0['onstage'] = 0
     .return ()
 .end
+.sub 'exeunt_omnes'
+    get_global $P0, 'the_cast'
+    .local int i,size
+    size = $P0
+    i=0
+  loop:
+    $P1 = $P0[i]
+    i = i + 1
+    $I0 = $P0['onstage']
+    unless $I0 goto loop
+    $P0['onstage'] = 0
+    if i == size goto end_loop
+    goto loop
+  end_loop:
+    .return ()
+.end
 
 .namespace []
 .sub 'tap'

File src/parser/actions.pm

        'declare')
     );
   }
-  for $<scene> {
+  for $<act> {
     $past.push( $( $_ ) );
   }
   make $past;
   make $( $/{$k} );
 }
 
+method act($/, $k) {
+    my $past := PAST::Stmts.new();
+    if $k eq 'open' {
+      #fugly
+      our $?ACT := ""~$<roman>;
+      # todop ignored?
+      $past.push(PAST::Op.new( :inline("act_"~$?ACT~":")));
+    }
+    else {
+      for $<scene> {
+        $past.push( $( $_ ) );
+      }
+    }
+    say("ll");
+    make $past;
+}
 method scene($/) {
+    our $?ACT;
     my $past := PAST::Stmts.new(:name($<roman>));
-    my $lbl := PAST::Op.new( :inline(""~$<roman>~":"));
+    my $lbl := PAST::Op.new( 
+      :inline("scene_"~$?ACT~"_"~$<roman>~":"));
     $past.push($lbl);
     for $<events> {
       $past.push( $( $_ ) );
 }
 
 method branch($/) {
-  make PAST::Op.new(:inline("goto "~$<roman>));
+  our $?ACT;
+  make PAST::Op.new(:inline("goto "~"scene_"~$?ACT~"_"~$<roman>));
 }
 
 method io($/,$k) {
   make $past;
 }
 
-method exeunts($/) {
+method exeunts($/, $k) {
   my $past := PAST::Stmts.new();
 
-  for $<charlist><character> {
-    my $res := mkcall( PAST::Val.new(
-        :value($_), 
-        :returns('String'),
-        ),'exit' );
-    $past.push($res);
+  say("here"~$k);
+  if $k eq 'list' {
+    for $<charlist><character> {
+      my $res := mkcall( PAST::Val.new(
+          :value($_), 
+          :returns('String'),
+          ),'exit' );
+      $past.push($res);
+    }
   }
+  else {
+    $past.push(mkcall0('exeunt_omnes'));
+  } 
   make $past;
 }
 method exits($/) {

File src/parser/grammar.pg

   <title>
   <chardef>*
   <act>*
-  <scene>* 
   {*}
 }
 
 }
 rule act {
   'act' <roman> ':' <description> <end>
+  {*} #= open
+  <scene>* 
+  {*} #= close
 }
 
 rule events {
  ']'
 }
 rule exeunts {
- '[' 
-  'exeunt' <charlist> {*} 
- ']'
+'[' 
+  [
+  |'exeunt' <charlist> {*} #= list
+  |'exeunt' {*} #= empty
+  ]
+']'
 }
 
 rule exits {

File src/parser/words.pg

  |'nicer'
  |'jollier'
 }
-token positive_noun {
+rule positive_noun {
  |'kingdom'
  |'heaven'
  |'king'
  |'happiness'
  |'joy'
  |'plum'
- |'summer day'
+ |'summer\'s' 'day'
  |'hero'
  |'rose'
  |'pony'
 
 romeo, a cool guy.
 juliet, a pretty girl.
+
+act I: dummy.
+
 scene i: foo.
 romeo: plan a pretty king! 
 juliet: proove a horse.
 othello, a lor.
 juliet, someont.
 
-scene i: foo.
+act i: foo .
+scene i: foo .
 
 [enter romeo and juliet]
 
 romeo, a nice one.
 othello, a lor.
 juliet, someont.
-
+      
+        act i: foo.
         scene i: foo.
 
 [enter romeo and juliet]

File t/04-unless.t

 othello, a lor.
 juliet, someont.
 
+        act i: foo.
 Scene I : no special characters. 
 [ENTER romeo and juliet]
 othello: plan a pretty pretty king .
 othello, someont.
 juliet, someont.
 
+        act i: foo.
 Scene I : no special characters. 
 [ENTER romeo and juliet]
 

File t/06-assignment.tno

 hamlet: smo.
 ophelia: smo.
 romeo: smo.
+        act i: foo.
                     Scene I: The insulting of Romeo.
 
 [Enter Hamlet and Romeo]

File t/06-enter.t

 hamlet, godoad.
 romeo, mnkn.
 ophelia, csmamalm.
+        act i: foo.
                     Scene I: The insulting of Romeo.
 
 [Enter Hamlet and Romeo]
 Hamlet, vgofof.
 Romeo,nnlknvsd.
 ophelia,mnknkl.
+        act i: foo.
                     Scene I: The insulting of Romeo.
 
 [Enter Hamlet and Romeo]

File t/08-assignment.t

 hamlet, smo.
 othello, smo.
 romeo, smo.
+        act i: foo.
                     Scene I: The insulting of Romeo.
 [enter othello]
 othello: plan a pretty pretty king.
 hamlet, smo.
 othello, smo.
 romeo, smo.
+Act I: foo.
                     Scene I: The insulting of Romeo.
 [enter othello]
 othello: plan a king.

File t/10-input.tno

 
 hamlet, smo.
 othello, smo.
+        act i: foo.
                     Scene I: The insulting of Romeo.
 [enter othello and hamlet]
 

File t/11-references.t

 hamlet, smo.
 othello, smo.
 romeo, smo.
+        act i: foo.
                     Scene I: The insulting of Romeo.
 [enter othello]
 othello: plan a pretty pretty king.