1. riffraff
  2. shakespeare-parrot

Commits

gabriele renzi  committed 9f7f734

references to your work

  • Participants
  • Parent commits 6b6c822
  • Branches default

Comments (0)

Files changed (5)

File example/sum2.sp

View file
  • Ignore whitespace
+
+Romeo, A character to store the sum.
+Juliet, An admirer who helps to calculate the sum.
+
+
+  Scene I: Juliet's conversation with Romeo.
+
+[Enter Romeo and Juliet]
+
+Juliet: Listen to your heart!
+
+Romeo:  You are as beautiful as a sweet red rose. 
+  Listen to your heart.
+
+Juliet: You are as brave as the sum of me and thyself.
+  Open your heart!
+
+[Exeunt]
+
+

File src/builtins/say.pir

View file
  • Ignore whitespace
     $P0['value'] = val
 .end
 
+.sub 'find_other_name'
+    $P0 = 'find_other'()
+    $P1 = $P0['name']
+    .return ($P1)
+.end
+
 .sub 'find_other'
     get_global $P0, 'the_speaker'
     .local int i, size, status

File src/parser/actions.pm

View file
  • Ignore whitespace
 }
 
 method reference($/, $k) {
+  if $k eq 'named_ref' {
   make mkcall( PAST::Val.new(
       :value($<character>), 
       :returns('String')
       ), 
     'valueof');
+  }
+  else {
+  make mkcall( mkcall0('find_other_name'), 'valueof');
+  }
 }
 
 method you_ref($/) {
-  make mkcall( PAST::Val.new(
-      :value($<character>), 
-      :returns('String')
-      ), 
-    'valueof');
 }
 
 method named_ref($/) {

File src/parser/words.pg

View file
  • Ignore whitespace
  |'distasteful'
  |'dusty'
  |'evil'
+ |'fatherless'
+ |'fat-kidneyed'
  |'fat'
- |'fat-kidneyed'
- |'fatherless'
  |'foul'
  |'hairy'
  |'half-witted'

File t/11-references.t

View file
  • Ignore whitespace
+juliet, smo.
+hamlet, smo.
+othello, smo.
+romeo, smo.
+                    Scene I: The insulting of Romeo.
+[enter othello]
+othello: plan a pretty pretty king.
+[Enter Hamlet]
+
+Hamlet: you are as sweet as a flower.proove yourself!
+
+Hamlet: you are twice yourself. proove thyself!
+ 
+Hamlet: you lying stupid fatherless big smelly half-witted coward! 
+ 
+hamlet: you are the sum of 
+    the sum of 
+      the square of 
+        the cube of a pretty king
+    and 
+      yourself
+  and
+    the sum of a pretty lord and a rose. Proove thyself!
+
+othello: you are the sum of yourself and a rose. Proove yourself!
+