cvsuser     03/07/02 20:42:53

  Modified:    languages/jako elem.jako io.jako string.jako sys.jako
               languages/jako/examples board.jako euclid.jako fact.jako
                        fib.jako hello.jako leibniz.jako life.jako
                        mandelbrot.jako mandelzoom.jako mops.jako nci.jako
                        primes.jako queens.jako sub.jako
               languages/jako/lib/Jako Lexer.pm Parser.pm Processor.pm
                        Symbol.pm Token.pm
               languages/jako/lib/Jako/Construct Block.pm
               languages/jako/lib/Jako/Construct/Block Sub.pm
               languages/jako/lib/Jako/Construct/Declaration Sub.pm
               languages/jako/lib/Jako/Construct/Expression Call.pm
               languages/jako/lib/Jako/Construct/Statement Call.pm
  Added:       languages/jako Curses.jako
               languages/jako/lib/Jako/Construct/Block Module.pm
  Log:
  Half-step towards a usable module system for Jako.
  
    * Changed the property syntax from {attr[=value],...} to :attr[=value]...
  
      Including changes to example programs to use new syntax.
  
    * Added a new construct: module
  
      Allows the grouping of sub declarations / definitions with a namespace.
  
    * Changed examples/nci.jako to use an embedded copy of the Curses module
      to reference the functions in the curses dynamically loadable library.
  
  NOTE: Before modules are truly useful, they will need to be loadable from
  separate files early on at compile time, probably with #line directives to
  keep things straight. For now, modules are great for grouping, but they
  have to be inside your single source file. And, all symbols in the module
  are exported to the parent namespace automatically.
  
  NOTE: The :: "delimiter" in namespaces is mapped to "__" for the benefit
  of IMCC, since it does not like "::" in identifiers.
  
  Revision  Changes    Path
  1.2       +39 -32    parrot/languages/jako/elem.jako
  
  Index: elem.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/elem.jako,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- elem.jako 13 Dec 2002 21:29:49 -0000      1.1
  +++ elem.jako 3 Jul 2003 03:42:39 -0000       1.2
  @@ -3,39 +3,46 @@
   #
   # Elementary Function ops.
   #
  -# $Id: elem.jako,v 1.1 2002/12/13 21:29:49 gregor Exp $
  +# Copyright (C) 2003 Gregor N. Purdy. All rights reserved.
  +# This program is free software. Its use is subject to the same
  +# license as Parrot.
  +#
  +# $Id: elem.jako,v 1.2 2003/07/03 03:42:39 gregor Exp $
   #
   
  -sub num acos  {op} (int x);
  -sub num acos  {op} (num x);
  -sub num asec  {op} (int x);
  -sub num asec  {op} (num x);
  -sub num atan  {op} (num x);
  -sub num atan  {op} (num x);
  -sub num atan2 {op} (int x, int y);
  -sub num atan2 {op} (int x, num y);
  -sub num atan2 {op} (num x, int y);
  -sub num atan2 {op} (num x, num y);
  -sub num cos   {op} (int x);
  -sub num cos   {op} (num x);
  -sub num cosh  {op} (int x);
  -sub num cosh  {op} (num x);
  -sub num exp   {op} (int x);
  -sub num exp   {op} (num x);
  -sub num ln    {op} (int x);
  -sub num ln    {op} (num x);
  -sub num log10 {op} (int x);
  -sub num log10 {op} (num x);
  -sub num log2  {op} (int x);
  -sub num log2  {op} (num x);
  -sub num sec   {op} (int x);
  -sub num sec   {op} (num x);
  -sub num sech  {op} (int x);
  -sub num sech  {op} (num x);
  -sub num sin   {op} (int x);
  -sub num sin   {op} (num x);
  -sub num sinh  {op} (int x);
  -sub num sinh  {op} (num x);
  -sub num tanh  {op} (int x);
  -sub num tanh  {op} (num x);
  +module elem
  +{
  +  sub num acos  :op (int x);
  +  sub num acos  :op (num x);
  +  sub num asec  :op (int x);
  +  sub num asec  :op (num x);
  +  sub num atan  :op (num x);
  +  sub num atan  :op (num x);
  +  sub num atan2 :op (int x, int y);
  +  sub num atan2 :op (int x, num y);
  +  sub num atan2 :op (num x, int y);
  +  sub num atan2 :op (num x, num y);
  +  sub num cos   :op (int x);
  +  sub num cos   :op (num x);
  +  sub num cosh  :op (int x);
  +  sub num cosh  :op (num x);
  +  sub num exp   :op (int x);
  +  sub num exp   :op (num x);
  +  sub num ln    :op (int x);
  +  sub num ln    :op (num x);
  +  sub num log10 :op (int x);
  +  sub num log10 :op (num x);
  +  sub num log2  :op (int x);
  +  sub num log2  :op (num x);
  +  sub num sec   :op (int x);
  +  sub num sec   :op (num x);
  +  sub num sech  :op (int x);
  +  sub num sech  :op (num x);
  +  sub num sin   :op (int x);
  +  sub num sin   :op (num x);
  +  sub num sinh  :op (int x);
  +  sub num sinh  :op (num x);
  +  sub num tanh  :op (int x);
  +  sub num tanh  :op (num x);
  +}
   
  
  
  
  1.2       +21 -12    parrot/languages/jako/io.jako
  
  Index: io.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/io.jako,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- io.jako   14 Dec 2002 01:29:24 -0000      1.1
  +++ io.jako   3 Jul 2003 03:42:39 -0000       1.2
  @@ -3,20 +3,29 @@
   #
   # Input/Output ops.
   #
  +# Copyright (C) 2003 Gregor N. Purdy. All rights reserved.
  +# This program is free software. Its use is subject to the same
  +# license as Parrot.
  +#
  +# $Id: io.jako,v 1.2 2003/07/03 03:42:39 gregor Exp $
  +#
   
  -sub obj open     {op} (str name, str mode);
  -sub obj fdopen   {op} (int fd, str mode);
  -sub     close    {op} (obj io);
  +module io
  +{
  +  sub obj open     :op (str name, str mode);
  +  sub obj fdopen   :op (int fd, str mode);
  +  sub     close    :op (obj io);
   
  -sub     print    {op} (obj io, str s);
  -sub     printerr {op} (str s);
  -sub     puts     {op} (str s);
  -sub     puts     {op} (int i);
  -sub     puts     {op} (num n);
  +  sub     print    :op (obj io, str s);
  +  sub     printerr :op (str s);
  +  sub     puts     :op (str s);
  +  sub     puts     :op (int i);
  +  sub     puts     :op (num n);
   
  -sub str read     {op} (int l);
  -sub str read     {op} (obj io, int l);
  +  sub str read     :op (int l);
  +  sub str read     :op (obj io, int l);
   
  -sub int seek     {op} (obj io, int offset, int whence);
  -sub int seek     {op} (obj io, int high, int low, int whence);
  +  sub int seek     :op (obj io, int offset, int whence);
  +  sub int seek     :op (obj io, int high, int low, int whence);
  +}
   
  
  
  
  1.2       +10 -1     parrot/languages/jako/string.jako
  
  Index: string.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/string.jako,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- string.jako       13 Dec 2002 21:29:49 -0000      1.1
  +++ string.jako       3 Jul 2003 03:42:39 -0000       1.2
  @@ -1,6 +1,15 @@
   #
   # string.jako
   #
  +# Copyright (C) 2003 Gregor N. Purdy. All rights reserved.
  +# This program is free software. Its use is subject to the
  +# same license as Parrot.
  +#
  +# $Id: string.jako,v 1.2 2003/07/03 03:42:39 gregor Exp $
  +#
   
  -sub str substr {op} (str s, int i, int l);
  +module string
  +{
  +  sub str substr :op (str s, int i, int l);
  +}
   
  
  
  
  1.2       +12 -3     parrot/languages/jako/sys.jako
  
  Index: sys.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/sys.jako,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- sys.jako  13 Dec 2002 21:29:49 -0000      1.1
  +++ sys.jako  3 Jul 2003 03:42:39 -0000       1.2
  @@ -3,8 +3,17 @@
   #
   # System ops.
   #
  +# Copyright (C) 2003 Gregor N. Purdy. All rights reserved.
  +# This program is free software. Its use is subject to the same
  +# license as Parrot.
  +#
  +# $Id: sys.jako,v 1.2 2003/07/03 03:42:39 gregor Exp $
  +#
   
  -sub     print {op} (str a)
  -sub int time  {op} ();
  -sub num time  {op} ();
  +module sys
  +{
  +  sub     print :op (str a)
  +  sub int time  :op ();
  +  sub num time  :op ();
  +}
   
  
  
  
  1.1                  parrot/languages/jako/Curses.jako
  
  Index: Curses.jako
  ===================================================================
  #
  # curses.jako
  #
  # A Jako module for interfacing with the curses library.
  #
  # Copyright (C) 2003 Gregor N. Purdy. All rights reserved.
  # This program is free software. Its use is subject to the same
  # license as Parrot.
  #
  # $Id: Curses.jako,v 1.1 2003/07/03 03:42:39 gregor Exp $
  #
  
  module curses : fnlib = "libcurses.so" {
  
    sub int initscr  ();
    sub int endwin   ();
    sub int curs_set (int x);
  
    sub int addstr   (str s);
    sub int refresh  ();
    sub int move     (int x, int y);
  
    sub int getch    ();
    sub int box      (int screen, int v, int h);
    sub int hline    (int ch, int n);
  
  }
  
  
  
  
  1.2       +2 -2      parrot/languages/jako/examples/board.jako
  
  Index: board.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/board.jako,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- board.jako        15 Dec 2002 02:14:48 -0000      1.1
  +++ board.jako        3 Jul 2003 03:42:41 -0000       1.2
  @@ -7,10 +7,10 @@
   # This program is free software. It is subject to the same
   # license as the Parrot interpreter.
   #
  -# $Id: board.jako,v 1.1 2002/12/15 02:14:48 gregor Exp $
  +# $Id: board.jako,v 1.2 2003/07/03 03:42:41 gregor Exp $
   #
   
  -sub print {op} (str s);
  +sub print :op (str s);
   
   var int rank, file;
   var int temp;
  
  
  
  1.3       +2 -2      parrot/languages/jako/examples/euclid.jako
  
  Index: euclid.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/euclid.jako,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- euclid.jako       13 Dec 2002 21:29:53 -0000      1.2
  +++ euclid.jako       3 Jul 2003 03:42:41 -0000       1.3
  @@ -14,10 +14,10 @@
   # This program is free software. It is subject to the same
   # license as the Parrot interpreter.
   #
  -# $Id: euclid.jako,v 1.2 2002/12/13 21:29:53 gregor Exp $
  +# $Id: euclid.jako,v 1.3 2003/07/03 03:42:41 gregor Exp $
   #
   
  -sub print {op} (str a);
  +sub print :op (str a);
   
   var int m, n, r;
   
  
  
  
  1.3       +2 -2      parrot/languages/jako/examples/fact.jako
  
  Index: fact.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/fact.jako,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- fact.jako 13 Dec 2002 21:29:53 -0000      1.2
  +++ fact.jako 3 Jul 2003 03:42:41 -0000       1.3
  @@ -9,10 +9,10 @@
   # This program is free software. It is subject to the same
   # license as the Parrot interpreter.
   #
  -# $Id: fact.jako,v 1.2 2002/12/13 21:29:53 gregor Exp $
  +# $Id: fact.jako,v 1.3 2003/07/03 03:42:41 gregor Exp $
   #
   
  -sub print {op} (str s);
  +sub print :op (str s);
   
   const int N = 15;
   
  
  
  
  1.3       +2 -2      parrot/languages/jako/examples/fib.jako
  
  Index: fib.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/fib.jako,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- fib.jako  13 Dec 2002 21:29:53 -0000      1.2
  +++ fib.jako  3 Jul 2003 03:42:41 -0000       1.3
  @@ -7,10 +7,10 @@
   # This program is free software. It is subject to the same
   # license as the Parrot interpreter.
   #
  -# $Id: fib.jako,v 1.2 2002/12/13 21:29:53 gregor Exp $
  +# $Id: fib.jako,v 1.3 2003/07/03 03:42:41 gregor Exp $
   #
   
  -sub print {op} (str s);
  +sub print :op (str s);
   
   const int n = 24;
   
  
  
  
  1.3       +2 -2      parrot/languages/jako/examples/hello.jako
  
  Index: hello.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/hello.jako,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- hello.jako        13 Dec 2002 21:29:53 -0000      1.2
  +++ hello.jako        3 Jul 2003 03:42:41 -0000       1.3
  @@ -7,9 +7,9 @@
   # This program is free software. It is subject to the same
   # license as the Parrot interpreter.
   #
  -# $Id: hello.jako,v 1.2 2002/12/13 21:29:53 gregor Exp $
  +# $Id: hello.jako,v 1.3 2003/07/03 03:42:41 gregor Exp $
   #
   
  -sub print {op} (str s);
  +sub print :op (str s);
   
   print("Hello, world!\n");
  
  
  
  1.3       +1 -1      parrot/languages/jako/examples/leibniz.jako
  
  Index: leibniz.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/leibniz.jako,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- leibniz.jako      13 Dec 2002 21:29:53 -0000      1.2
  +++ leibniz.jako      3 Jul 2003 03:42:41 -0000       1.3
  @@ -16,7 +16,7 @@
   # license as the Parrot interpreter.
   #
   
  -sub print {op} (str s);
  +sub print :op (str s);
   
   const num first_den =       1.0;
   const num last_den  = 1000000.0;
  
  
  
  1.3       +12 -12    parrot/languages/jako/examples/life.jako
  
  Index: life.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/life.jako,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- life.jako 3 Feb 2003 11:48:29 -0000       1.2
  +++ life.jako 3 Jul 2003 03:42:41 -0000       1.3
  @@ -1,7 +1,7 @@
   #
   # life.jako
   #
  -# Play Conway's (no, not *him*. The other Conway) game of life
  +# Play Conway's (no, not *him*. The other Conway) game of life.
   #
   # Based on life.pasm, Hacked by Leon Brocard <[EMAIL PROTECTED]> to use curses.
   #
  @@ -10,18 +10,18 @@
   #     http://archive.develooper.com/[EMAIL PROTECTED]/msg13935.html
   #
   
  -sub num time   {op} ();
  -sub     sleep  {op} (int n);
  -sub     concat {op} (str dest, str s);
  -sub int length {op} (str dest);
  -sub str substr {op} (str s, int i, int l);
  +sub num time   :op ();
  +sub     sleep  :op (int n);
  +sub     concat :op (str dest, str s);
  +sub int length :op (str dest);
  +sub str substr :op (str s, int i, int l);
   
  -sub int initscr  {fnlib = "libcurses.so"} ();
  -sub int endwin   {fnlib = "libcurses.so"} ();
  -sub int curs_set {fnlib = "libcurses.so"} (int x);
  -sub int addstr   {fnlib = "libcurses.so"} (str s);
  -sub int refresh  {fnlib = "libcurses.so"} ();
  -sub int move     {fnlib = "libcurses.so"} (int x, int y);
  +sub int initscr  :fnlib = "libcurses.so" ();
  +sub int endwin   :fnlib = "libcurses.so" ();
  +sub int curs_set :fnlib = "libcurses.so" (int x);
  +sub int addstr   :fnlib = "libcurses.so" (str s);
  +sub int refresh  :fnlib = "libcurses.so" ();
  +sub int move     :fnlib = "libcurses.so" (int x, int y);
   
   var int foo; # Store result from above functions here.
   
  
  
  
  1.3       +2 -2      parrot/languages/jako/examples/mandelbrot.jako
  
  Index: mandelbrot.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/mandelbrot.jako,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- mandelbrot.jako   13 Dec 2002 21:29:53 -0000      1.2
  +++ mandelbrot.jako   3 Jul 2003 03:42:41 -0000       1.3
  @@ -28,8 +28,8 @@
   # license as the Parrot interpreter.
   #
   
  -sub print {op} (str s);
  -sub str substr {op} (str s, int i, int l);
  +sub     print  :op (str s);
  +sub str substr :op (str s, int i, int l);
   
   var str b = " .:,;!/>)|&IH%*#";
   
  
  
  
  1.4       +3 -3      parrot/languages/jako/examples/mandelzoom.jako
  
  Index: mandelzoom.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/mandelzoom.jako,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- mandelzoom.jako   16 Dec 2002 01:56:25 -0000      1.3
  +++ mandelzoom.jako   3 Jul 2003 03:42:41 -0000       1.4
  @@ -28,9 +28,9 @@
   # license as the Parrot interpreter.
   #
   
  -sub print {op} (str s);
  -sub sleep {op} (int n);
  -sub str substr {op} (str s, int i, int l);
  +sub     print  :op (str s);
  +sub     sleep  :op (int n);
  +sub str substr :op (str s, int i, int l);
   
   const str CHARS = " .:,;!/>)|&IH%*#";
   const int DEPTH = 112;
  
  
  
  1.3       +3 -3      parrot/languages/jako/examples/mops.jako
  
  Index: mops.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/mops.jako,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- mops.jako 13 Dec 2002 21:29:53 -0000      1.2
  +++ mops.jako 3 Jul 2003 03:42:41 -0000       1.3
  @@ -5,11 +5,11 @@
   # This program is free software. It is subject to the same
   # license as the Parrot interpreter.
   #
  -# $Id: mops.jako,v 1.2 2002/12/13 21:29:53 gregor Exp $
  +# $Id: mops.jako,v 1.3 2003/07/03 03:42:41 gregor Exp $
   #
   
  -sub print {op} (str s);
  -sub num time {op} ();
  +sub     print :op (str s);
  +sub num time  :op ();
   
   var num start_time;
   var num end_time;
  
  
  
  1.2       +32 -28    parrot/languages/jako/examples/nci.jako
  
  Index: nci.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/nci.jako,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- nci.jako  2 Jul 2003 23:08:31 -0000       1.1
  +++ nci.jako  3 Jul 2003 03:42:41 -0000       1.2
  @@ -9,41 +9,45 @@
   # license as Parrot.
   #
   
  -sub int initscr  {fnlib = "libcurses.so"} ();
  -sub int endwin   {fnlib = "libcurses.so"} ();
  -sub int curs_set {fnlib = "libcurses.so"} (int x);
  -
  -sub int addstr   {fnlib = "libcurses.so"} (str s);
  -sub int refresh  {fnlib = "libcurses.so"} ();
  -sub int move     {fnlib = "libcurses.so"} (int x, int y);
  -
  -sub int getch    {fnlib = "libcurses.so"} ();
  -sub int box      {fnlib = "libcurses.so"} (int screen, int v, int h);
  -sub int hline    {fnlib = "libcurses.so"} (int ch, int n);
  -
  -sub str readline {op} (int fd);
  +module Curses
  +  :fnlib = "libcurses.so"
  +{
  +  sub int initscr  :fn ();
  +  sub int endwin   :fn ();
  +  sub int curs_set :fn (int x);
  +
  +  sub int addstr   :fn (str s);
  +  sub int refresh  :fn ();
  +  sub int move     :fn (int x, int y);
  +
  +  sub int getch    :fn ();
  +  sub int box      :fn (int screen, int v, int h);
  +  sub int hline    :fn (int ch, int n);
  +}
   
   var int foo; # Store result from above functions here.
   
   var int screen;
  -screen = initscr();
   
  -foo = curs_set(0);
  -foo = box(screen, 42, 42);
  -foo = move(10, 20);
  -foo = addstr("Hello, world!");
  -foo = move(12, 15);
  -foo = addstr("(Press any key to exit)");
  +screen = Curses::initscr();
  +
  +foo = Curses::curs_set(0);
  +foo = Curses::box(screen, 42, 42);
  +foo = Curses::move(10, 20);
  +foo = Curses::addstr("Hello, world!");
  +foo = Curses::move(12, 15);
  +foo = Curses::addstr("(Press any key to exit)");
  +
  +foo = Curses::move(8, 10);
  +foo = Curses::hline(42, 33);
   
  -foo = move(8, 10);
  -foo = hline(42, 33);
  +foo = Curses::move(14, 10);
  +foo = Curses::hline(42, 33);
   
  -foo = move(14, 10);
  -foo = hline(42, 33);
  +foo = Curses::refresh();
   
  -foo = refresh();
  +foo = Curses::getch();
   
  -foo = getch();
  +foo = Curses::curs_set(1);
  +foo = Curses::endwin();
   
  -foo = curs_set(1);
  -foo = endwin();
  
  
  
  1.3       +2 -2      parrot/languages/jako/examples/primes.jako
  
  Index: primes.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/primes.jako,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- primes.jako       13 Dec 2002 21:29:53 -0000      1.2
  +++ primes.jako       3 Jul 2003 03:42:41 -0000       1.3
  @@ -9,10 +9,10 @@
   # This program is free software. It is subject to the same
   # license as the Parrot interpreter.
   #
  -# $Id: primes.jako,v 1.2 2002/12/13 21:29:53 gregor Exp $
  +# $Id: primes.jako,v 1.3 2003/07/03 03:42:41 gregor Exp $
   #
   
  -sub print {op} (str s);
  +sub print :op (str s);
   
   const int n = 100;
   
  
  
  
  1.10      +5 -5      parrot/languages/jako/examples/queens.jako
  
  Index: queens.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/queens.jako,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -w -r1.9 -r1.10
  --- queens.jako       1 Jul 2003 15:47:30 -0000       1.9
  +++ queens.jako       3 Jul 2003 03:42:41 -0000       1.10
  @@ -7,13 +7,13 @@
   # This program is free software. It is subject to the same
   # license as the Parrot interpreter.
   #
  -# $Id: queens.jako,v 1.9 2003/07/01 15:47:30 gregor Exp $
  +# $Id: queens.jako,v 1.10 2003/07/03 03:42:41 gregor Exp $
   #
   
  -sub     print  {op} (str s);
  -sub str substr {op} (str s, int i, int l);
  -sub str concat {op} (str s, str t);
  -sub int length {op} (str s);
  +sub     print  :op (str s);
  +sub str substr :op (str s, int i, int l);
  +sub str concat :op (str s, str t);
  +sub int length :op (str s);
   
   const int NUM_FILES = 8;
   const int NUM_RANKS = 8;
  
  
  
  1.3       +2 -2      parrot/languages/jako/examples/sub.jako
  
  Index: sub.jako
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/examples/sub.jako,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- sub.jako  13 Dec 2002 21:29:53 -0000      1.2
  +++ sub.jako  3 Jul 2003 03:42:41 -0000       1.3
  @@ -8,10 +8,10 @@
   # This program is free software. It is subject to the same
   # license as the Parrot interpreter.
   #
  -# $Id: sub.jako,v 1.2 2002/12/13 21:29:53 gregor Exp $
  +# $Id: sub.jako,v 1.3 2003/07/03 03:42:41 gregor Exp $
   #
   
  -sub print {op} (str s);
  +sub print :op (str s);
   
   var int x;
   
  
  
  
  1.6       +17 -3     parrot/languages/jako/lib/Jako/Lexer.pm
  
  Index: Lexer.pm
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/lib/Jako/Lexer.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- Lexer.pm  20 Dec 2002 01:58:52 -0000      1.5
  +++ Lexer.pm  3 Jul 2003 03:42:45 -0000       1.6
  @@ -5,7 +5,7 @@
   # This program is free software. It is subject to the same license
   # as the Parrot interpreter.
   #
  -# $Id: Lexer.pm,v 1.5 2002/12/20 01:58:52 gregor Exp $
  +# $Id: Lexer.pm,v 1.6 2003/07/03 03:42:45 gregor Exp $
   #
   
   use strict;
  @@ -118,6 +118,13 @@
       # Declarators:
       #
   
  +    if ($text =~ m{^(module)(?!\w)(.*)$}) {
  +      push @tokens, Jako::Token->new(
  +        $file, $line, 'module', undef, $1);
  +      $text = $2;
  +      next;
  +    }
  +
       if ($text =~ m{^(sub)(?!\w)(.*)$}) {
         push @tokens, Jako::Token->new(
           $file, $line, 'sub', undef, $1);
  @@ -155,6 +162,13 @@
         next;
       }
   
  +    if ($text =~ m{^([:])(.*)$}) {
  +      push @tokens, Jako::Token->new(
  +        $file, $line, 'colon', undef, $1);
  +      $text = $2;
  +      next;
  +    }
  +
       if ($text =~ m{^([;])(.*)$}) {
         push @tokens, Jako::Token->new(
           $file, $line, 'semicolon', undef, $1);
  @@ -269,10 +283,10 @@
       # Identifiers:
       #
   
  -    if ($text =~ m{^([a-zA-Z][a-zA-Z0-9_]*)(.*)$}) {
  +    if ($text =~ m{^([a-zA-Z][a-zA-Z0-9_]*(::[a-zA-Z][a-zA-Z0-9_]*)*)(.*)$}) {
         push @tokens, Jako::Token->new(
           $file, $line, 'ident', undef, $1);
  -      $text = $2;
  +      $text = $3;
         next;
       }
      
  
  
  
  1.12      +57 -17    parrot/languages/jako/lib/Jako/Parser.pm
  
  Index: Parser.pm
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/lib/Jako/Parser.pm,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -w -r1.11 -r1.12
  --- Parser.pm 3 Feb 2003 11:48:34 -0000       1.11
  +++ Parser.pm 3 Jul 2003 03:42:45 -0000       1.12
  @@ -5,7 +5,7 @@
   # This program is free software. It is subject to the same license
   # as Perl itself.
   #
  -# $Id: Parser.pm,v 1.11 2003/02/03 11:48:34 gregor Exp $
  +# $Id: Parser.pm,v 1.12 2003/07/03 03:42:45 gregor Exp $
   #
   
   use strict;
  @@ -22,6 +22,7 @@
   use Jako::Construct::Block::Conditional::Else;
   use Jako::Construct::Block::Conditional::If;
   use Jako::Construct::Block::Conditional::Unless;
  +use Jako::Construct::Block::Module;
   use Jako::Construct::Block::Sub;
   use Jako::Construct::Block::Loop::Continue;
   use Jako::Construct::Block::Loop::Until;
  @@ -221,6 +222,45 @@
       }
   
       #
  +    # Modules:
  +    #
  +    #   module <ident> [:<prop>[=<value] ...] {
  +    #
  +
  +    if ($token->is_module) {
  +      my $block = $self->current_block;
  +
  +      my $ident = Jako::Construct::Expression::Value::Identifier->new($block, 
$self->require_ident);
  +      my $name = $ident->value;
  +
  +      #
  +      # Allow there to be Properties:
  +      #
  +
  +      my %props;
  +
  +      while ($self->skip_colon) {
  +        my $prop = $self->require_ident->text;
  +
  +        my $value;
  +
  +        if ($self->skip_assign) {
  +          $value = Jako::Construct::Expression::Value::Literal->new($block, 
$self->require_literal);
  +        }
  +
  +        $props{$prop} = $value;
  +      }
  +
  +      $self->require_open_brace;
  +
  +      my $module = Jako::Construct::Block::Module->new($block, $ident, { %props });
  +      push @{$self->{BLOCKS}}, $module;
  +
  +      next;
  +
  +    }
  +
  +    #
       # Variable declarations:
       #
       #   var <type> <ident>;
  @@ -282,10 +322,7 @@
       #
       # Subroutines:
       #
  -    #   sub        <ident>          (<arg>, <arg>, ...) {
  -    #   sub <type> <ident>          (<arg>, <arg>, ...) {
  -    #   sub        <ident> {<prop>} (<arg>, <arg>, ...) {
  -    #   sub <type> <ident> {<prop>} (<arg>, <arg>, ...) {
  +    #   sub [<type>] <ident> [:<prop>[=<value] ...] (<arg>, <arg>, ...) {
       #
   
       if ($token->is_sub) {
  @@ -305,8 +342,7 @@
   
         my %props;
   
  -      if ($self->skip_open_brace and not $self->skip_close_brace) { # In case empty.
  -        while (1) {
  +      while ($self->skip_colon) {
             my $prop = $self->require_ident->text;
         
             my $value;
  @@ -316,11 +352,6 @@
             }
   
             $props{$prop} = $value;
  -          last if $self->get(1)->is_close_brace;
  -          $self->require_comma;
  -        }
  -
  -        $self->skip_close_brace;
         }
   
         #
  @@ -549,6 +580,15 @@
         #
   
         elsif ($peer_block->kind eq 'sub') {
  +        # DO NOTHING
  +      }
  +
  +      #
  +      # Handle the ending of module blocks:
  +      #
  +
  +      elsif ($peer_block->kind eq 'module') {
  +        # DO NOTHING
         }
   
         #
  
  
  
  1.3       +2 -1      parrot/languages/jako/lib/Jako/Processor.pm
  
  Index: Processor.pm
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/lib/Jako/Processor.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- Processor.pm      20 Dec 2002 01:58:52 -0000      1.2
  +++ Processor.pm      3 Jul 2003 03:42:45 -0000       1.3
  @@ -5,7 +5,7 @@
   # This program is free software. It is subject to the same license
   # as the Parrot interpreter.
   #
  -# $Id: Processor.pm,v 1.2 2002/12/20 01:58:52 gregor Exp $
  +# $Id: Processor.pm,v 1.3 2003/07/03 03:42:45 gregor Exp $
   #
   
   use strict;
  @@ -368,6 +368,7 @@
   #
   
   sub skip_assign        { return shift->skip('assign');        }
  +sub skip_colon         { return shift->skip('colon');         }
   sub skip_comma         { return shift->skip('comma');         }
   sub skip_close_brace   { return shift->skip('close-brace');   }
   sub skip_close_bracket { return shift->skip('close-bracket'); }
  
  
  
  1.4       +4 -3      parrot/languages/jako/lib/Jako/Symbol.pm
  
  Index: Symbol.pm
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/lib/Jako/Symbol.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- Symbol.pm 20 Dec 2002 01:58:52 -0000      1.3
  +++ Symbol.pm 3 Jul 2003 03:42:45 -0000       1.4
  @@ -5,7 +5,7 @@
   # This program is free software. It is subject to the same license
   # as the Parrot interpreter.
   #
  -# $Id: Symbol.pm,v 1.3 2002/12/20 01:58:52 gregor Exp $
  +# $Id: Symbol.pm,v 1.4 2003/07/03 03:42:45 gregor Exp $
   #
   
   use strict;
  @@ -41,8 +41,8 @@
     confess("Undefined identifier kind attribute.")
       unless defined $kind;
    
  -  confess("Unrecognized identifier kind attribute '%s'.", $kind)
  -    unless $kind eq 'sub' or $kind eq 'var' or $kind eq 'arg' or $kind eq 'const';
  +  confess("Unrecognized identifier kind attribute '" . $kind . "'.")
  +    unless $kind eq 'module' or $kind eq 'sub' or $kind eq 'var' or $kind eq 'arg' 
or $kind eq 'const';
   
     my $self = bless {
       BLOCK  => $block,
  @@ -82,6 +82,7 @@
   sub is_constant { return shift->kind eq 'const'; }
   sub is_variable { my $self = shift; return $self->kind eq 'var' or $self->kind = 
'arg'; }
   sub is_sub      { my $self = shift; return $self->kind eq 'sub'; }
  +sub is_module   { my $self = shift; return $self->kind eq 'module'; }
   
   1;
   
  
  
  
  1.3       +4 -2      parrot/languages/jako/lib/Jako/Token.pm
  
  Index: Token.pm
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/lib/Jako/Token.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- Token.pm  20 Dec 2002 01:58:52 -0000      1.2
  +++ Token.pm  3 Jul 2003 03:42:45 -0000       1.3
  @@ -5,7 +5,7 @@
   # This program is free software. It is subject to the same license
   # as the Parrot interpreter.
   #
  -# $Id: Token.pm,v 1.2 2002/12/20 01:58:52 gregor Exp $
  +# $Id: Token.pm,v 1.3 2003/07/03 03:42:45 gregor Exp $
   #
   #
   
  @@ -106,6 +106,7 @@
   sub is_close_brace   { return shift->is('close-brace');   }
   sub is_close_bracket { return shift->is('close-bracket'); }
   sub is_close_paren   { return shift->is('close-paren');   }
  +sub is_colon         { return shift->is('colon');         }
   sub is_const         { return shift->is('const');         }
   sub is_continue      { return shift->is('continue');      }
   sub is_else          { return shift->is('else');          }
  @@ -120,6 +121,7 @@
   sub is_label         { return shift->is('label');         }
   sub is_last          { return shift->is('last');          }
   sub is_literal       { return shift->is('literal');       }
  +sub is_module        { return shift->is('module');        }
   sub is_next          { return shift->is('next');          }
   sub is_open_brace    { return shift->is('open-brace');    }
   sub is_open_bracket  { return shift->is('open-bracket');  }
  
  
  
  1.6       +43 -1     parrot/languages/jako/lib/Jako/Construct/Block.pm
  
  Index: Block.pm
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/lib/Jako/Construct/Block.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- Block.pm  3 Feb 2003 11:48:41 -0000       1.5
  +++ Block.pm  3 Jul 2003 03:42:46 -0000       1.6
  @@ -7,7 +7,7 @@
   # This program is free software. It is subject to the same license
   # as the Parrot interpreter.
   #
  -# $Id: Block.pm,v 1.5 2003/02/03 11:48:41 gregor Exp $
  +# $Id: Block.pm,v 1.6 2003/07/03 03:42:46 gregor Exp $
   #
   
   use strict;
  @@ -78,6 +78,48 @@
     $self->{SYMBOLS}{$name} = $sym if defined $sym;
   
     return $self->{SYMBOLS}{$name};
  +}
  +
  +
  +#
  +# symbols()
  +#
  +
  +sub symbols
  +{
  +  my $self = shift;
  +
  +  return keys %{$self->{SYMBOLS}};
  +}
  +
  +
  +#
  +# dump_symbols()
  +#
  +
  +sub dump_symbols
  +{
  +  my $self = shift;
  +
  +  my $block = $self;
  +
  +  my %table = ();
  +
  +  my $level = 0;
  +
  +  while ($block) {
  +    foreach my $symbol ($block->symbols) {
  +      next if exists $table{$symbol};
  +      $table{$symbol} = $level;
  +    }
  +
  +    $block = $block->block;
  +    $level++;
  +  }
  +
  +  foreach my $symbol (sort keys %table) {
  +    printf STDERR "%s: %d\n", $symbol, $table{$symbol};
  +  }
   }
   
   
  
  
  
  1.6       +7 -5      parrot/languages/jako/lib/Jako/Construct/Block/Sub.pm
  
  Index: Sub.pm
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/lib/Jako/Construct/Block/Sub.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- Sub.pm    3 Feb 2003 11:48:52 -0000       1.5
  +++ Sub.pm    3 Jul 2003 03:42:48 -0000       1.6
  @@ -5,7 +5,7 @@
   # This program is free software. It is subject to the same license
   # as the Parrot interpreter.
   #
  -# $Id: Sub.pm,v 1.5 2003/02/03 11:48:52 gregor Exp $
  +# $Id: Sub.pm,v 1.6 2003/07/03 03:42:48 gregor Exp $
   #
   
   use strict;
  @@ -56,8 +56,6 @@
     return $self;
   }
   
  -1;
  -
   
   #
   # ACCESSORS:
  @@ -83,9 +81,13 @@
     my %props = $self->props;
     my @args  = $self->args;
   
  -  my $namespace = "_SUB_$name";
  +  my $subname = $name;
  +
  +  $subname =~ s/::/__/g;
  +
  +  my $namespace = "_SUB_$subname";
   
  -  $compiler->emit(".sub _${name}");
  +  $compiler->emit(".sub _${subname}");
     $compiler->emit(".namespace $namespace");
     $compiler->emit("saveall");
   
  
  
  
  1.1                  parrot/languages/jako/lib/Jako/Construct/Block/Module.pm
  
  Index: Module.pm
  ===================================================================
  #
  # Module.pm
  #
  # Copyright (C) 2003 Gregor N. Purdy. All rights reserved.
  # This program is free software. It is subject to the same license
  # as the Parrot interpreter.
  #
  # $Id: Module.pm,v 1.1 2003/07/03 03:42:48 gregor Exp $
  #
  
  use strict;
  eval "use warnings";
  
  package Jako::Construct::Block::Module;
  
  use Carp;
  
  use Jako::Compiler;
  
  use base qw(Jako::Construct::Block);
  
  sub kind { return 'module'; }
  
  sub new
  {
    my $class = shift;
  
    confess "Expected 3 args!" unless @_ == 3;
    my ($block, $ident, $props) = @_;
  
    confess "Block is not!" unless UNIVERSAL::isa($block, 'Jako::Construct::Block');
    confess "Ident is not!" unless UNIVERSAL::isa($ident, 
'Jako::Construct::Expression::Value::Identifier');
    confess "Props are not hash!" if defined $props and ref($props) ne "HASH";
  
    my $self = bless {
      BLOCK => $block,
  
      TYPE  => undef,
      NAME  => $ident->value,
      PROPS => $props,
      ARGS  => undef,
  
      DEBUG => 1,
      FILE  => $ident->file,
      LINE  => $ident->line
    }, $class;
  
    $block->push_content($self);
  
    return $self;
  }
  
  
  #
  # ACCESSORS:
  #
  
  sub type      { return shift->{TYPE};      }
  sub name      { return shift->{NAME};      }
  sub props     { return %{shift->{PROPS}};  }
  
  
  #
  # compile()
  #
  
  sub compile
  {
    my $self = shift;
    my ($compiler) = @_;
  
    my $namespace = "MODULE"; # TODO: Don't we need to do better than this?
  
    #
    # Import our symbols into our parent block:
    #
  
    foreach my $symbol ($self->symbols) {
      next if $self->block->symbol($symbol);
  
      $self->block->symbol($symbol, $self->symbol($symbol));
    }
  
    if ($self->content) {
      $compiler->emit(".namespace ${namespace}");
      $compiler->indent;
      $self->SUPER::compile($compiler);
      $compiler->outdent;
      $compiler->emit(".endnamespace ${namespace}");
    }
  
    return 1;
  }
  
  
  #
  # sax()
  #
  
  sub sax
  {
    my $self = shift;
    my ($handler) = @_;
  
    $handler->start_element({ Name => 'module', Attributes => { name => $self->name } 
});
    $_->sax($handler) foreach $self->content;
    $handler->end_element({ Name => 'module' });
  }
  
  
  1;
  
  
  
  1.7       +44 -11    parrot/languages/jako/lib/Jako/Construct/Declaration/Sub.pm
  
  Index: Sub.pm
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/lib/Jako/Construct/Declaration/Sub.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- Sub.pm    2 Jul 2003 23:09:24 -0000       1.6
  +++ Sub.pm    3 Jul 2003 03:42:50 -0000       1.7
  @@ -5,7 +5,7 @@
   # This program is free software. It is subject to the same license
   # as the Parrot interpreter.
   #
  -# $Id: Sub.pm,v 1.6 2003/07/02 23:09:24 gregor Exp $
  +# $Id: Sub.pm,v 1.7 2003/07/03 03:42:50 gregor Exp $
   #
   
   use strict;
  @@ -63,7 +63,9 @@
     # Lookup the identifier:
     #
   
  -  my $sym = $block->find_symbol($self->name);
  +  my $name = $self->name;
  +
  +  my $sym = $block->find_symbol($name);
   
     #
     # If the identifier is already defined at ANY lexical scope, we want to complain
  @@ -73,7 +75,7 @@
   
     if (defined $sym) {
       $self->SYNTAX_ERROR("Redeclaration of identifier '%s'. Previous declaration on 
line %d of file '%s'.",
  -      $self->name, $sym->line, $sym->file);
  +      $name, $sym->line, $sym->file);
     }
   
     #
  @@ -87,7 +89,7 @@
       $self->block,
       $self->kind,
       $self->type,
  -    $self->name,
  +    $name,
       undef,            # No value
       $props,           # Parsed Properties
       $args,            # Parsed Properties
  @@ -95,8 +97,6 @@
       $self->line
     );
   
  -  my $name = $self->name;
  -
   #  $self->DEBUG(0, "Remembering symbol '$name' as sub...");
   
     $block->symbol($name, $sym);
  @@ -110,7 +110,19 @@
   
   sub kind  { return shift->{KIND};     }
   sub type  { return shift->{TYPE};     }
  -sub name  { return shift->{NAME};     }
  +
  +sub name
  +{
  +  my $self = shift;
  +  my $name = $self->{NAME};
  +
  +  if ($self->block->kind eq 'module') {
  +    $name = $self->block->name . "::" . $name;
  +  }
  +
  +  return $name;
  +}
  +
   sub props { return %{shift->{PROPS}}; }
   sub args  { return @{shift->{ARGS}};  }
   
  @@ -135,11 +147,28 @@
   
     my %props = $sym->props;
   
  -  if (exists $props{fnlib}) {
  -    my $fnlib = $props{fnlib}->value; # TODO: We should make sure its a string, 
somewhere.
  +  if (exists $props{fn} or exists $props{fnlib}) {
  +    my $fnlib;
  +
  +    if (exists $props{fnlib} and $props{fnlib}) {
  +      $fnlib = $props{fnlib}->value; # TODO: We should make sure its a string, 
somewhere.
  +    }
  +    else {
  +      $self->SYNTAX_ERROR("Sub declaration has no fnlib property, and parent block 
is not a module!")
  +        unless $self->block->kind eq 'module';
  +
  +      my %module_props = $self->block->props;
  +
  +      $self->SYNTAX_ERROR("Sub declaration has no fnlib property, and parent module 
has no fnlib property either!")
  +        unless $module_props{fnlib};
  +
  +      $fnlib = $module_props{fnlib}->value;
  +    }
  +
       my $fn    = $props{fn} ? $props{fn}->value : "\"$name\"";
   
       my $thunk = "_${name}_THUNK";
  +    $thunk =~ s/::/__/g;
   
       $compiler->emit(".sub $thunk");
       $compiler->emit(".namespace $thunk");
  @@ -168,9 +197,13 @@
       $compiler->emit("  I2 = 0");       # Number of parameters in PMC registers.
       $compiler->emit("  I3 = $return"); # What we expect in return
   
  +    my $fn_name = $fn;
  +
  +    $fn_name =~ s/^.*::/"/;
  +
       $compiler->emit("  .local obj lib");
       $compiler->emit("  loadlib lib, $fnlib");
  -    $compiler->emit("  dlfunc P0, lib, $fn, \"$sig\"");
  +    $compiler->emit("  dlfunc P0, lib, $fn_name, \"$sig\"");
       $compiler->emit("  invoke");
   
       if ($self->type) {
  
  
  
  1.7       +13 -3     parrot/languages/jako/lib/Jako/Construct/Expression/Call.pm
  
  Index: Call.pm
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/lib/Jako/Construct/Expression/Call.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- Call.pm   3 Feb 2003 11:49:15 -0000       1.6
  +++ Call.pm   3 Jul 2003 03:42:51 -0000       1.7
  @@ -5,7 +5,7 @@
   # This program is free software. It is subject to the same license
   # as the Parrot interpreter.
   #
  -# $Id: Call.pm,v 1.6 2003/02/03 11:49:15 gregor Exp $
  +# $Id: Call.pm,v 1.7 2003/07/03 03:42:51 gregor Exp $
   #
   
   use strict;
  @@ -65,7 +65,10 @@
   
     my $sym = $self->block->find_symbol($name);
   
  -  $self->SYNTAX_ERROR("Call to unknown sub '%s'.", $name) unless $sym;
  +  unless ($sym) {
  +#    $self->block->dump_symbols;
  +    $self->SYNTAX_ERROR("Call to unknown sub '%s'.", $name);
  +  }
   
     my %props = $sym->props;
   
  @@ -107,10 +110,13 @@
       }
     }
   
  -  if (exists $props{fnlib}) {
  +  if (exists $props{fn} or exists $props{fnlib}) {
       foreach my $arg (@args) {
         $compiler->emit("  .arg $arg");
       }
  +
  +    $name =~ s/::/__/g;
  + 
       $compiler->emit("  call _${name}_THUNK");
     }
     elsif (exists $props{op}) {
  @@ -120,6 +126,8 @@
   
       $name = $op if defined $op;
   
  +    $name =~ s/^.*:://; # Delete namespaces from ops
  +
       $compiler->emit("  $name ", join(", ", $dest, @args));
     }
     else {
  @@ -128,6 +136,8 @@
       foreach my $arg (@args) {
         $compiler->emit("  .arg $arg");
       }
  +
  +    $name =~ s/::/__/g;
   
       $compiler->emit("  call _${name}");
       $compiler->emit("  .result $dest");
  
  
  
  1.7       +14 -3     parrot/languages/jako/lib/Jako/Construct/Statement/Call.pm
  
  Index: Call.pm
  ===================================================================
  RCS file: /cvs/public/parrot/languages/jako/lib/Jako/Construct/Statement/Call.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- Call.pm   3 Feb 2003 11:49:27 -0000       1.6
  +++ Call.pm   3 Jul 2003 03:42:53 -0000       1.7
  @@ -5,7 +5,7 @@
   # This program is free software. It is subject to the same license
   # as the Parrot interpreter.
   #
  -# $Id: Call.pm,v 1.6 2003/02/03 11:49:27 gregor Exp $
  +# $Id: Call.pm,v 1.7 2003/07/03 03:42:53 gregor Exp $
   #
   
   use strict;
  @@ -104,10 +104,13 @@
       }
     }
   
  -  if (exists $props{fnlib}) {
  +  if (exists $props{fn} or exists $props{fnlib}) {
       foreach my $arg (@args) {
         $compiler->emit("  .arg $arg");
       }
  +
  +    $name =~ s/::/__/g;
  +
       $compiler->emit("  call _${name}_THUNK");
     }
     elsif (exists $props{op}) {
  @@ -115,7 +118,12 @@
   
   #    $self->DEBUG(0, "Calling %s%s...", $name, ($op ? ' (op $op)' : ' as op'));
   
  -    $name = $op if defined $op;
  +    if (defined $op) {
  +      $name = $op->value;
  +      $name =~ s/(^"|"$)//g;
  +    }
  +
  +    $name =~ s/^.*:://; # Strip namespaces off ops.
   
       $compiler->emit("  $name ", join(", ", @args));
     }
  @@ -125,6 +133,9 @@
       foreach my $arg (@args) {
         $compiler->emit("  .arg $arg");
       }
  +
  +    $name =~ s/::/__/;
  +
       $compiler->emit("  call _${name}");
     }
   
  
  
  

Reply via email to