nice-commit Mailing List for The Nice Programming Language (Page 100)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bo...@us...> - 2003-06-17 11:59:59
|
Update of /cvsroot/nice/Nice/testsuite/compiler/macros In directory sc8-pr-cvs1:/tmp/cvs-serv22460/testsuite/compiler/macros Log Message: Directory /cvsroot/nice/Nice/testsuite/compiler/macros added to the repository |
From: <bo...@us...> - 2003-06-17 11:39:21
|
Update of /cvsroot/nice/Nice/regtest/multipkg In directory sc8-pr-cvs1:/tmp/cvs-serv19072/regtest/multipkg Modified Files: import.nice Log Message: Updated not to declare two variables of same name in the same scope. Index: import.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/multipkg/import.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** import.nice 20 Feb 2003 11:54:49 -0000 1.15 --- import.nice 17 Jun 2003 11:39:17 -0000 1.16 *************** *** 33,37 **** polymorphic2(new regtest.basic.Multi()); ! iter(["A"], String s => println(s)); /* Must fail: map(["A"], fun(String s)=>{println(s);}); */ --- 33,37 ---- polymorphic2(new regtest.basic.Multi()); ! iter(["A"], String str => println(str)); /* Must fail: map(["A"], fun(String s)=>{println(s);}); */ |
From: <bo...@us...> - 2003-06-17 09:27:44
|
Update of /cvsroot/nice/Nice/testsuite/compiler/native In directory sc8-pr-cvs1:/tmp/cvs-serv29819/testsuite/compiler/native Modified Files: methods.testsuite Log Message: bug #755742 Index: methods.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/native/methods.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** methods.testsuite 20 May 2003 14:48:10 -0000 1.2 --- methods.testsuite 17 Jun 2003 09:27:41 -0000 1.3 *************** *** 9,10 **** --- 9,18 ---- byte->String f = Byte.toString; String[] s = [1].map(int i => toString(i)); + + /// PASS + // bug #755742 + let s1 = "abc"; + let s2 = "xyz"; + List<String> list1 = [s1, s2]; + List<String> list2 = [s1, s2]; + assert list1.equals(list2); |
From: <bo...@us...> - 2003-06-17 04:30:49
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv27834/stdlib/nice/lang Modified Files: numeric.nice Log Message: Use a contract to check that exponents are positive. Index: numeric.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/numeric.nice,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** numeric.nice 11 Jun 2003 12:21:26 -0000 1.28 --- numeric.nice 17 Jun 2003 04:30:46 -0000 1.29 *************** *** 214,219 **** // exponential functions ! long `**`(long x, long e) { ! if (e < 0) throw new IllegalArgumentException(); if (e == 0) return 1; --- 214,220 ---- // exponential functions ! long `**`(long x, long e) ! requires e >= 0 : "Exponent should be positive. It was " + e ! { if (e == 0) return 1; |
From: <bo...@us...> - 2003-06-17 04:30:48
|
Update of /cvsroot/nice/Nice/testsuite/lib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv27834/testsuite/lib/nice/lang Modified Files: numeric.testsuite Log Message: Use a contract to check that exponents are positive. Index: numeric.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/nice/lang/numeric.testsuite,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** numeric.testsuite 17 Jun 2003 04:19:24 -0000 1.6 --- numeric.testsuite 17 Jun 2003 04:30:46 -0000 1.7 *************** *** 110,111 **** --- 110,120 ---- assert 5**3**2 != (5**3)**2; assert 5**3**2 == 1953125; + + /// PASS + int i = -1; + boolean ok = true; + try { + long j = 3 ** i; + ok = false; + } catch(Throwable e) {} + assert ok; |
From: <bo...@us...> - 2003-06-17 04:19:26
|
Update of /cvsroot/nice/Nice/testsuite/lib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv26623/testsuite/lib/nice/lang Modified Files: numeric.testsuite Log Message: Make it obvious that ** is right associative. Index: numeric.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/nice/lang/numeric.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** numeric.testsuite 3 Jun 2003 20:41:27 -0000 1.5 --- numeric.testsuite 17 Jun 2003 04:19:24 -0000 1.6 *************** *** 107,109 **** --- 107,111 ---- assert 3**9 == 19683; assert -7**5 == -16807; + assert 5**3**2 == 5**(3**2); + assert 5**3**2 != (5**3)**2; assert 5**3**2 == 1953125; |
From: <ar...@us...> - 2003-06-16 21:33:18
|
Update of /cvsroot/nice/Nice/testsuite/compiler/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv4943/F:/nice/testsuite/compiler/syntax Modified Files: tupleArguments.testsuite Log Message: added assert statements and another bug case. Index: tupleArguments.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/syntax/tupleArguments.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tupleArguments.testsuite 16 Jun 2003 15:12:08 -0000 1.1 --- tupleArguments.testsuite 16 Jun 2003 21:33:14 -0000 1.2 *************** *** 7,15 **** /// PASS ! let ((String, String))->() foo = ((String s, String t))=> println(s+t); ! foo(("sdjfl","sdfjl")); /// PASS ((String, int))->(String, int) foo = ((String s, int i) tuple)=> tuple; /// PASS bug --- 7,17 ---- /// PASS ! let ((String, String))->String foo = ((String s, String t))=> s+t; ! assert foo(("ab","cd")).equals("abcd"); /// PASS ((String, int))->(String, int) foo = ((String s, int i) tuple)=> tuple; + (String, int) tuple = ("abc", 5); + assert tuple==foo(tuple); /// PASS bug *************** *** 20,42 **** /// PASS /// Toplevel ! int foo((int i, char c)) = i + int(c); /// PASS /// Toplevel void foo((String s, String t) tuple) { - print(s+t); (String x, String y) = tuple; } /// PASS /// Toplevel ! void foo((String s, String t) tuple = ("abc", "xyz")) {} ! /// PASS /// Toplevel ! void foo((String s,(char c, int i))) {} ! /// PASS /// Toplevel ! void foo(((char c, int i),String s)) {} --- 22,60 ---- /// PASS + assert foo((100,1))==101; /// Toplevel ! int foo((int i, short s)) = i + s; /// PASS + foo(("zyx","ksjdf")); /// Toplevel void foo((String s, String t) tuple) { (String x, String y) = tuple; + assert x.equals(s); + assert y.equals(t); } /// PASS + (String s, String t) = foo(); + assert s.equals("abc"); + assert t.equals("xyz"); /// Toplevel ! (String, String) foo((String s, String t) tuple = ("abc", "xyz")) = tuple; ! /// PASS bug ! assert foo(("abc",('x',3)))==3; /// Toplevel ! int foo((String s,(char c, int i))) = i; ! /// PASS ! // this one is not a bug, compare with previous ! char c = 'x'; ! int i = 3; ! assert foo(("abc",(c,i)))==3; /// Toplevel ! int foo((String s,(char c, int i))) = i; ! ! /// PASS bug ! assert foo((('y',7),"xyz"))==7; ! /// Toplevel ! int foo(((char c, int i),String s)) = i; |
From: <ar...@us...> - 2003-06-16 20:40:39
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv25583/F:/nice/debian Modified Files: changelog Log Message: update changelog for tuples syntax addition. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.179 retrieving revision 1.180 diff -C2 -d -r1.179 -r1.180 *** changelog 15 Jun 2003 19:07:41 -0000 1.179 --- changelog 16 Jun 2003 20:40:36 -0000 1.180 *************** *** 31,34 **** --- 31,41 ---- * Method bodies with a single statement can be written without brackets. example: void foo() = throw new Exception; + * Implemented the enhanced syntax for tuples in function declarations: + String foo((String s, String t)) = s+t; + It also works for anonymous functions: + List<(String, int)> tuples = new ArrayList(); + tuples.add(("abc", 1)); + tuples.foreach(((String name, int number)) => + println("name: "+name+" number: "+number) ); * Bugfixes (Parsing of nested tuples, global constants of type char, Overloading resolving of methods implementation with additional tc's, ...) |
From: <bo...@us...> - 2003-06-16 18:53:18
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv6184/web Added Files: irc.xml Log Message: Added a page about the #nice irc channel. --- NEW FILE: irc.xml --- <?xml version="1.0" standalone="no"?> <page> <title>#nice</title> <description> The #nice online discussion service. </description> <keywords>nice, irc, chat </keywords> <para> There is an online discussion channel dedicated to the Nice programming language, since June 15th 2003. The developers often meet there to discuss about the implementation, or about new features. Users are welcome too. So pop by and be our guests! (Most developers are currently from Europe, and we are there during the day or the evening). </para> <para> To participate, you will need an IRC client. Set it up to connect to the server <literal>irc.freenode.net</literal>. Then <literal>/join #nice</literal>. In some web-browsers, you can simply <ulink url="irc://irc.freenode.net/nice">follow this link</ulink>. </para> <para> Freenode, the server that hosts the channel, is a special IRC server. For instance, you can register your identity, and protect it by a password. For more information, see the <ulink url="http://www.freenode.net">freenode website</ulink>. </para> <para> <ulink url="http://pauillac.inria.fr/~bonniot/nice@freenode/"> Archives of the IRC conversations</ulink> are available. </para> <para> This service is provided by <ulink url="http://www.freenode.net"> <inlinemediaobject><imageobject> <imagedata fileref="http://irc.wearlab.de/images/freenode_logo.jpg" width="237px" depth="68px" align="center" /> </imageobject></inlinemediaobject> </ulink> </para> </page> |
From: <bo...@us...> - 2003-06-16 18:52:59
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv6103/web Modified Files: new.xsl Makefile .cvsignore Log Message: Added a page about the #nice irc channel. Index: new.xsl =================================================================== RCS file: /cvsroot/nice/Nice/web/new.xsl,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** new.xsl 30 May 2003 11:37:46 -0000 1.9 --- new.xsl 16 Jun 2003 18:52:54 -0000 1.10 *************** *** 135,144 **** --- 135,151 ---- <a class="nav" href="/cgi-bin/twiki/view/Doc/WebHome"> Collaborative site (Wiki)</a> + <br /> <span class="small">o</span><xsl:text> </xsl:text> <a class="nav" href="http://sourceforge.net/forum/forum.php?forum_id=40268">Forums</a> + <br /> <span class="small">o</span><xsl:text> </xsl:text> <a class="nav" href="http://lists.sourceforge.net/lists/listinfo/nice-info">Mailing List</a> + + <br /> + <span class="small">o</span><xsl:text> </xsl:text> + <a class="nav" href="irc.html"> + Online discussion</a> <!-- <br /> *************** *** 149,152 **** --- 156,160 ---- <span class="small">o</span><xsl:text> </xsl:text> <a class="nav" href="http://sourceforge.net/project/filemodule_monitor.php?filemodule_id=11365">Notify me of new versions</a> + <br /> <span class="small">o</span><xsl:text> </xsl:text> Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/web/Makefile,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Makefile 30 May 2003 12:07:55 -0000 1.11 --- Makefile 16 Jun 2003 18:52:54 -0000 1.12 *************** *** 14,18 **** all: index.html research.html compilation.html testimonials.html install.html \ ! roadmap.html safety.html manual.html manual.pdf manual.ps send: all --- 14,18 ---- all: index.html research.html compilation.html testimonials.html install.html \ ! irc.html roadmap.html safety.html manual.html manual.pdf manual.ps send: all Index: .cvsignore =================================================================== RCS file: /cvsroot/nice/Nice/web/.cvsignore,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** .cvsignore 27 Apr 2003 22:20:06 -0000 1.9 --- .cvsignore 16 Jun 2003 18:52:54 -0000 1.10 *************** *** 2,5 **** --- 2,6 ---- index.html install.html + irc.html manual.html research.html |
From: <ar...@us...> - 2003-06-16 15:12:12
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv3668/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Implemented the use of tuple arguments in methods and anonymous functions. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.187 retrieving revision 1.188 diff -C2 -d -r1.187 -r1.188 *** Parser.jj 15 Jun 2003 14:20:57 -0000 1.187 --- Parser.jj 16 Jun 2003 15:12:08 -0000 1.188 *************** *** 859,884 **** } - List namedMonotypes(): - { - List res=new ArrayList(); - Monotype t; - } - { - t=monotype() [ident()] { res.add(t); } - ( "," t=monotype() [ident()] { res.add(t); } )* - { return res; } - } - /***********************************************************************/ /* Classes */ /***********************************************************************/ ! FormalParameters.Parameter formalParameter(): { ! Monotype t; ! LocatedString id; ! Expression val; } { t = monotype() [ --- 859,898 ---- } /***********************************************************************/ /* Classes */ /***********************************************************************/ ! Expression ParameterTuplePart(List statements, List monotypes): ! { LocatedString id; Monotype type; } { ! ( ! LOOKAHEAD( monotype() ident() ) ! type=monotype() id=ident() ! { monotypes.add(type); ! statements.add(new Block.LocalVariable(id, type, false, null)); ! return new IdentExp(id); } ! | { Token first,last; } ! first="(" ! { List parts = new LinkedList(); Expression part; ! List types = new LinkedList(); } ! part = ParameterTuplePart(statements, types) { parts.add(part); } ! ( "," part = ParameterTuplePart(statements, types) { parts.add(part); } )+ ! last=")" ! { Monotype t = new TupleType(types, new Location(first, last)); ! t.nullness = Monotype.absent; ! monotypes.add(t); ! return new TupleExp(parts); } ! ) } + + FormalParameters.Parameter formalParameter(List statements): { + Monotype t = null; + LocatedString id = null; + Expression val = null; + } + { + ( + LOOKAHEAD(monotype()) t = monotype() [ *************** *** 891,897 **** ] { return new FormalParameters.Parameter(t); } } ! FormalParameters formalParameters(boolean leaveRoomForThis): { List params = null; --- 905,937 ---- ] { return new FormalParameters.Parameter(t); } + | + { Token first,last; + List parts = new LinkedList(); + Expression part; + List types = new LinkedList(); + LocatedString ident; } + first="(" + part = ParameterTuplePart(statements, types) { parts.add(part); } + ( "," part = ParameterTuplePart(statements, types) { parts.add(part); } )+ + last=")" + [ id=ident() [ "=" val=Expression() ] ] + { if (id == null) { + ident = new LocatedString("tuple_arg_" + first.beginLine + "_" + first.beginColumn, + new Location(first, last)); + } else { ident = id; } + Expression exp = AssignExp.create(new TupleExp(parts),new IdentExp(ident)); + exp.setLocation(new Location(first,last)); + statements.add(new ExpressionStmt(exp)); + t = new TupleType(types, new Location(first, last)); + t.nullness = Monotype.absent; + if (val != null) + return new FormalParameters.OptionalParameter(t, ident, val); + + return new FormalParameters.NamedParameter(t, ident); + } + ) } ! FormalParameters formalParameters(boolean leaveRoomForThis, List statements): { List params = null; *************** *** 907,914 **** } [ ! p = formalParameter() { if (params ==null) params = new LinkedList(); params.add(p); } ! ( "," p = formalParameter() { params.add(p); } )* ] { return new FormalParameters(params); } --- 947,954 ---- } [ ! p = formalParameter(statements) { if (params ==null) params = new LinkedList(); params.add(p); } ! ( "," p = formalParameter(statements) { params.add(p); } )* ] { return new FormalParameters(params); } *************** *** 923,926 **** --- 963,967 ---- Statement body = null; Contract contract; + List statements = new LinkedList(); } { *************** *** 928,937 **** returnType=monotype() name=identOrBackquoted() ! "(" parameters = formalParameters(true) ")" contract = contract() ! ( ";" | body = code() ) { return NiceMethod.create(c, name, cst, returnType, parameters, ! body, contract); } } --- 969,978 ---- returnType=monotype() name=identOrBackquoted() ! "(" parameters = formalParameters(true, statements) ")" contract = contract() ! ( ";" | body = code() {statements.add(body);} ) { return NiceMethod.create(c, name, cst, returnType, parameters, ! body!=null?new Block(statements):null , contract); } } *************** *** 1326,1329 **** --- 1367,1371 ---- Constraint cst; MethodDeclaration res; + List statements = new LinkedList(); } { *************** *** 1332,1336 **** returnType=monotype() name=identOrBackquoted() ! "(" parameters = formalParameters(false) ")" ( LOOKAHEAD(2) --- 1374,1378 ---- returnType=monotype() name=identOrBackquoted() ! "(" parameters = formalParameters(false, statements) ")" ( LOOKAHEAD(2) *************** *** 1353,1359 **** ( { Statement body; } ! body = code() { res = new ToplevelFunction(name, cst, returnType, parameters, ! body, contract);} | // Nice method --- 1395,1401 ---- ( { Statement body; } ! body=code() { statements.add(body); } { res = new ToplevelFunction(name, cst, returnType, parameters, ! body!=null?new Block(statements):null, contract);} | // Nice method *************** *** 1535,1538 **** --- 1577,1581 ---- } + /***********************************************************************/ /* Expressions */ *************** *** 1620,1656 **** } ! FunExp funExpLookahead(): {} { ( ! LOOKAHEAD ( ["fun"] constraint() "(" monoSymbols() ")" ) ! ["fun"] constraint() "(" monoSymbols() ")" | monoSymbol() ) "=>" ! { return null; } } FunExp funExp(): { ! List formals; Constraint cst = Constraint.True; MonoSymbol sym; Statement body; Expression exp; ! Token f; } { ( ! LOOKAHEAD ( ["fun"] constraint() "(" monoSymbols() ")" ) ! [ ! f="fun" { bossa.util.User.warning(new Location(f), ! "The 'fun(...) =>' syntax is deprecated, just leave 'fun' away."); } ! ] ! cst=constraint() ! "(" formals=monoSymbols() ")" ! | ! sym=monoSymbol() { formals = new LinkedList(); formals.add(sym); } ) "=>" --- 1663,1737 ---- } ! void funExpLookahead(): {} { ( ! LOOKAHEAD ( "(" ")" ) "(" ")" | + LOOKAHEAD ( monoSymbol() ) monoSymbol() + | + constraint() "(" NestedMonoSymbols() ")" ) "=>" ! } ! ! MonoSymbol funExpParameter(List statements): ! { ! Monotype type; ! LocatedString name; ! } ! { ! ( ! LOOKAHEAD( monotype() ) ! type=monotype() name=ident() ! { return new MonoSymbol(name,type); } ! | ! { Token first,last; ! List parts = new LinkedList(); ! Expression part; ! List types = new LinkedList(); ! LocatedString ident = null; ! } ! ! first="(" ! part = ParameterTuplePart(statements, types) { parts.add(part); } ! ( "," part = ParameterTuplePart(statements, types) { parts.add(part); } )+ ! last=")" ! [ ident=ident() ] ! { if (ident == null) { ! name = new LocatedString("tuple_arg_" + first.beginLine + "_" + first.beginColumn, ! new Location(first, last)); ! } else { name = ident; } ! Expression exp = AssignExp.create(new TupleExp(parts),new IdentExp(name)); ! exp.setLocation(new Location(first,last)); ! statements.add(new ExpressionStmt(exp)); ! type = new TupleType(types, new Location(first, last)); ! type.nullness = Monotype.absent; ! return new MonoSymbol(name, type); ! } ! ) } FunExp funExp(): { ! List formals = new LinkedList(); Constraint cst = Constraint.True; MonoSymbol sym; Statement body; Expression exp; ! List statements = new LinkedList(); } { ( ! LOOKAHEAD ( "(" ")" ) "(" ")" ! | ! LOOKAHEAD ( monoSymbol() ) ! sym=monoSymbol() { formals.add(sym); } ! | ! cst=constraint() "(" ! sym=funExpParameter(statements) { formals.add(sym); } ! ( "," sym=funExpParameter(statements) { formals.add(sym); } )* ! ")" ) "=>" *************** *** 1660,1664 **** exp=Expression() { body = new ReturnStmt(exp); } ) ! { return new FunExp(cst,formals,body); } } --- 1741,1746 ---- exp=Expression() { body = new ReturnStmt(exp); } ) ! { statements.add(body); ! return new FunExp(cst, formals, new Block(statements)); } } *************** *** 2474,2477 **** --- 2556,2560 ---- boolean constant = true; Token t = null; + List statements = new LinkedList(); } { *************** *** 2488,2493 **** type = monotype() id=ident() ! "(" parameters=formalParameters(false) ")" body=code() ! { return Block.LocalFunction.make(id, type, parameters, body); } ) } --- 2571,2577 ---- type = monotype() id=ident() ! "(" parameters=formalParameters(false, statements) ")" ! body=code() { statements.add(body); } ! { return Block.LocalFunction.make(id, type, parameters, body!=null?new Block(statements):null); } ) } *************** *** 2541,2551 **** */ ! "(" LocalTupleDeclarationContent() ")" "=" } ! void LocalTupleDeclarationContent() : { } { ( ! "(" LocalTupleDeclarationContent() ")" // Identifiers, either in types, or as a variable to assign to. | <IDENT> --- 2625,2635 ---- */ ! "(" NestedMonoSymbols() ")" "=" } ! void NestedMonoSymbols() : { } { ( ! "(" NestedMonoSymbols() ")" // Identifiers, either in types, or as a variable to assign to. | <IDENT> |
From: <ar...@us...> - 2003-06-16 15:12:12
|
Update of /cvsroot/nice/Nice/testsuite/compiler/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv3668/F:/nice/testsuite/compiler/syntax Added Files: tupleArguments.testsuite Log Message: Implemented the use of tuple arguments in methods and anonymous functions. --- NEW FILE: tupleArguments.testsuite --- /// PASS List<(String, int)> tuples = new ArrayList(); tuples.add(("a", 1)); tuples.add(("b", 2)); tuples.foreach(((String letter, int number)) => println("letter: "+letter+" number: "+number) ); /// PASS let ((String, String))->() foo = ((String s, String t))=> println(s+t); foo(("sdjfl","sdfjl")); /// PASS ((String, int))->(String, int) foo = ((String s, int i) tuple)=> tuple; /// PASS bug /// Toplevel let ((String, String))->() foo = ((String s, String t))=> { println(s+t); }; /// PASS /// Toplevel int foo((int i, char c)) = i + int(c); /// PASS /// Toplevel void foo((String s, String t) tuple) { print(s+t); (String x, String y) = tuple; } /// PASS /// Toplevel void foo((String s, String t) tuple = ("abc", "xyz")) {} /// PASS /// Toplevel void foo((String s,(char c, int i))) {} /// PASS /// Toplevel void foo(((char c, int i),String s)) {} |
From: <bo...@us...> - 2003-06-15 19:07:44
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv13248/debian Modified Files: changelog Log Message: Typo. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.178 retrieving revision 1.179 diff -C2 -d -r1.178 -r1.179 *** changelog 15 Jun 2003 15:11:04 -0000 1.178 --- changelog 15 Jun 2003 19:07:41 -0000 1.179 *************** *** 15,19 **** * The 'char' type is no longer a subtype of int. The integer unicode representation of a character c can be obtained by int(c). ! * Added dispatch on global constants which value is a literal. Example: let int specialValue = 7; void foo(int); --- 15,19 ---- * The 'char' type is no longer a subtype of int. The integer unicode representation of a character c can be obtained by int(c). ! * Added dispatch on global constants whose value is a literal. Example: let int specialValue = 7; void foo(int); |
From: <bo...@us...> - 2003-06-15 15:11:08
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv15164/debian Modified Files: changelog Log Message: Indent the code examples, so they are easier to spot and to read. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -d -r1.177 -r1.178 *** changelog 15 Jun 2003 14:20:57 -0000 1.177 --- changelog 15 Jun 2003 15:11:04 -0000 1.178 *************** *** 15,32 **** * The 'char' type is no longer a subtype of int. The integer unicode representation of a character c can be obtained by int(c). ! * Added dispatch on global constants which value is a literal. example: ! let int specialValue = 7; ! void foo(int); ! foo(n) { /*do something*/ } ! foo(=specialValue) { /*do something else*/ } * Redefining of local variables in their scope is not allowed anymore. ! * Dispatch on global constants works also for unique references(new Objects). ! class Color {} ! let Color red = new Color(); ! let Color blue = new Color(); ! String name(Color); ! name(color) = "unknown color"; ! name(=red) = "red"; ! name(=blue) = "blue"; * Method bodies with a single statement can be written without brackets. example: void foo() = throw new Exception; --- 15,32 ---- * The 'char' type is no longer a subtype of int. The integer unicode representation of a character c can be obtained by int(c). ! * Added dispatch on global constants which value is a literal. Example: ! let int specialValue = 7; ! void foo(int); ! foo(n) { /*do something*/ } ! foo(=specialValue) { /*do something else*/ } * Redefining of local variables in their scope is not allowed anymore. ! * Dispatch on global constants works also for unique references(new objects). ! class Color {} ! let Color red = new Color(); ! let Color blue = new Color(); ! String name(Color); ! name(color) = "unknown color"; ! name(=red) = "red"; ! name(=blue) = "blue"; * Method bodies with a single statement can be written without brackets. example: void foo() = throw new Exception; |
From: <ar...@us...> - 2003-06-15 14:21:00
|
Update of /cvsroot/nice/Nice/testsuite/compiler/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv9285/F:/nice/testsuite/compiler/syntax Modified Files: anonymousFunctions.testsuite Log Message: Minor cleanup again. Index: anonymousFunctions.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/syntax/anonymousFunctions.testsuite,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** anonymousFunctions.testsuite 29 May 2003 14:03:14 -0000 1.8 --- anonymousFunctions.testsuite 15 Jun 2003 14:20:57 -0000 1.9 *************** *** 34,35 **** --- 34,41 ---- /// PASS void m(boolean->() f) {} + + /// PASS + void foo() = throw new Exception(); + void bar(int i) = if (i > 0) foo(); + void foobar(boolean b) = assert b; + |
From: <ar...@us...> - 2003-06-15 14:21:00
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv9285/F:/nice/debian Modified Files: changelog Log Message: Minor cleanup again. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.176 retrieving revision 1.177 diff -C2 -d -r1.176 -r1.177 *** changelog 15 Jun 2003 11:28:53 -0000 1.176 --- changelog 15 Jun 2003 14:20:57 -0000 1.177 *************** *** 29,32 **** --- 29,34 ---- name(=red) = "red"; name(=blue) = "blue"; + * Method bodies with a single statement can be written without brackets. + example: void foo() = throw new Exception; * Bugfixes (Parsing of nested tuples, global constants of type char, Overloading resolving of methods implementation with additional tc's, ...) |
From: <ar...@us...> - 2003-06-15 14:21:00
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv9285/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Minor cleanup again. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.186 retrieving revision 1.187 diff -C2 -d -r1.186 -r1.187 *** Parser.jj 15 Jun 2003 12:54:23 -0000 1.186 --- Parser.jj 15 Jun 2003 14:20:57 -0000 1.187 *************** *** 1266,1273 **** ( ".." "." { return null; } // toplevel function in interface file | ! exp=Expression() ";" ! { ! code = new ReturnStmt(exp, /* fake */ true); ! } ) ) --- 1266,1283 ---- ( ".." "." { return null; } // toplevel function in interface file | ! exp=Expression() ";" { code = new ReturnStmt(exp, /* fake */ true); } ! | ! {Statement res;} ! ( ! res = ShortIfStatement() ! | ! res = ShortAssertStatement() ! | ! res = ShortThrowStatement() ! ) ! ";" ! { List statements = new LinkedList(); ! statements.add(res); ! return new Block(statements); } ) ) |
From: <ar...@us...> - 2003-06-15 13:15:30
|
Update of /cvsroot/nice/Nice/stdlib/nice/getopt In directory sc8-pr-cvs1:/tmp/cvs-serv30876/F:/nice/stdlib/nice/getopt Modified Files: gnugetopt.nice Log Message: Minor cleanup again. Index: gnugetopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/gnugetopt.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gnugetopt.nice 15 Jun 2003 11:52:17 -0000 1.6 --- gnugetopt.nice 15 Jun 2003 13:15:27 -0000 1.7 *************** *** 35,39 **** private ?String optarg = null; ! private ?String nextchar = null; private boolean posixly_correct = System.getProperty("gnu.posixly_correct", null) != null; private boolean longopt_handled = false; --- 35,39 ---- private ?String optarg = null; ! private String nextchar = ""; private boolean posixly_correct = System.getProperty("gnu.posixly_correct", null) != null; private boolean longopt_handled = false; *************** *** 166,179 **** exact = false; longind = -1; ! nameend = notNull(nextchar).indexOf("="); if (nameend == -1) ! nameend = notNull(nextchar).length(); // Test all lnog options for either exact match or abbreviated matches for (int i = 0; i < long_options.length; i++) { ! if (long_options[i].getName().startsWith(notNull(nextchar).substring(0, nameend))) { ! if (long_options[i].getName().equals(notNull(nextchar).substring(0, nameend))) { // Exact match found --- 166,179 ---- exact = false; longind = -1; ! nameend = nextchar.indexOf("="); if (nameend == -1) ! nameend = nextchar.length(); // Test all lnog options for either exact match or abbreviated matches for (int i = 0; i < long_options.length; i++) { ! if (long_options[i].getName().startsWith(nextchar.substring(0, nameend))) { ! if (long_options[i].getName().equals(nextchar.substring(0, nameend))) { // Exact match found *************** *** 213,222 **** ++optind; ! if (nameend != notNull(nextchar).length()) { if (pfound.has_arg != NO_ARGUMENT) { ! if (notNull(nextchar).substring(nameend).length() > 1) ! optarg = notNull(nextchar).substring(nameend+1); else optarg = ""; --- 213,222 ---- ++optind; ! if (nameend != nextchar.length()) { if (pfound.has_arg != NO_ARGUMENT) { ! if (nextchar.substring(nameend).length() > 1) ! optarg = nextchar.substring(nameend+1); else optarg = ""; *************** *** 281,285 **** return noOptionsLeft; ! if ((nextchar == null) || (nextchar.equals(""))) { // If we have just processed some options following some non-options, --- 281,285 ---- return noOptionsLeft; ! if (nextchar.equals("")) { // If we have just processed some options following some non-options, *************** *** 387,391 **** // Otherwise interpret it as a short option. if (!long_only || argv[optind].startsWith("--") ! || (optstring.indexOf(notNull(nextchar).charAt(0)) == -1)) { if (opterr) --- 387,391 ---- // Otherwise interpret it as a short option. if (!long_only || argv[optind].startsWith("--") ! || (optstring.indexOf(nextchar.charAt(0)) == -1)) { if (opterr) *************** *** 405,411 **** // Look at and handle the next short option-character */ ! char c = notNull(nextchar).charAt(0); ! if (notNull(nextchar).length() > 1) ! nextchar = notNull(nextchar).substring(1); else nextchar = ""; --- 405,411 ---- // Look at and handle the next short option-character */ ! char c = nextchar.charAt(0); ! if (nextchar.length() > 1) ! nextchar = nextchar.substring(1); else nextchar = ""; *************** *** 463,467 **** // Let the application handle it { ! nextchar = null; ++optind; return('W'); --- 463,467 ---- // Let the application handle it { ! nextchar = ""; ++optind; return('W'); *************** *** 484,488 **** } ! nextchar = null; } else --- 484,488 ---- } ! nextchar = ""; } else *************** *** 533,537 **** } ! nextchar = null; } } --- 533,537 ---- } ! nextchar = ""; } } |
From: <ar...@us...> - 2003-06-15 13:05:48
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv29112/F:/nice/src/bossa/syntax Modified Files: Pattern.java Log Message: Stricter check for #type patterns. Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Pattern.java 14 Jun 2003 16:21:26 -0000 1.55 --- Pattern.java 15 Jun 2003 13:05:45 -0000 1.56 *************** *** 110,118 **** { tc = typeConstructor.resolveToTC(scope); ! if (exactlyAt && TypeConstructors.isInterface(tc)) User.error (typeConstructor.location(), "Pattern #" + typeConstructor + ! " cannot be matched because interfaces do not have direct instances."); typeConstructor = null; } --- 110,118 ---- { tc = typeConstructor.resolveToTC(scope); ! if (exactlyAt && !TypeConstructors.instantiable(tc)) User.error (typeConstructor.location(), "Pattern #" + typeConstructor + ! " cannot be matched because interfaces and abstract classes do not have direct instances."); typeConstructor = null; } |
From: <ar...@us...> - 2003-06-15 13:05:48
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv29112/F:/nice/testsuite/compiler/methods Modified Files: globalconstant.testsuite implementations.testsuite integer.testsuite Log Message: Stricter check for #type patterns. Index: globalconstant.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/globalconstant.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** globalconstant.testsuite 14 Jun 2003 16:21:26 -0000 1.3 --- globalconstant.testsuite 15 Jun 2003 13:05:46 -0000 1.4 *************** *** 84,94 **** let Color blue = new Color(); let Color green = new Color(); ! String string(Color); ! string(color) = "unknown color"; ! string(=red) = "red"; ! string(=blue) = "blue"; ! string(=green) = "green"; /// package b import a ! assert red.string().equals("red"); ! assert blue.string().equals("blue"); ! assert green.string().equals("green"); --- 84,94 ---- let Color blue = new Color(); let Color green = new Color(); ! String name(Color); ! name(color) = "unknown color"; ! name(=red) = "red"; ! name(=blue) = "blue"; ! name(=green) = "green"; /// package b import a ! assert red.name().equals("red"); ! assert blue.name().equals("blue"); ! assert green.name().equals("green"); Index: implementations.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/implementations.testsuite,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** implementations.testsuite 24 May 2003 19:55:58 -0000 1.11 --- implementations.testsuite 15 Jun 2003 13:05:46 -0000 1.12 *************** *** 77,80 **** --- 77,87 ---- /// FAIL /// Toplevel + abstract class X {} + + void foo(X); + foo(#X){} + + /// FAIL + /// Toplevel class A {} class B extends A{} Index: integer.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/integer.testsuite,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** integer.testsuite 14 Jun 2003 17:43:45 -0000 1.7 --- integer.testsuite 15 Jun 2003 13:05:46 -0000 1.8 *************** *** 45,54 **** /// package a /// Toplevel ! void foo(char); ! foo(@char) {} ! foo(='a') {} ! /// package b import a ! ; /// FAIL --- 45,54 ---- /// package a /// Toplevel ! boolean foo(char); ! foo(@char) = false; ! foo(='\1') = true; ! foo(='\3') = false; /// package b import a ! assert foo('\1'); /// FAIL |
Update of /cvsroot/nice/Nice/regtest/basic In directory sc8-pr-cvs1:/tmp/cvs-serv27685/regtest/basic Modified Files: null.nice native.nice methods.nice generic.nice constants.nice classes.nice arrays.nice Log Message: Updated to the new syntaxes for dispatch. Index: null.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/null.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** null.nice 30 May 2002 13:50:30 -0000 1.11 --- null.nice 15 Jun 2003 12:58:30 -0000 1.12 *************** *** 27,33 **** cov(s1@String, s2@String) {} ! cov(s1@String, s2@null) {} ! cov(s1@null, s2@String) {} ! cov(s1@null, s2@null) {} // nullness marker with a parameterized type in constraint --- 27,33 ---- cov(s1@String, s2@String) {} ! cov(s1@String, null) {} ! cov(null, s2@String) {} ! cov(null, null) {} // nullness marker with a parameterized type in constraint Index: native.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/native.nice,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** native.nice 10 Jun 2003 15:51:52 -0000 1.13 --- native.nice 15 Jun 2003 12:58:30 -0000 1.14 *************** *** 37,46 **** println(Fields.stringS + Fields.intS); ! Fields f = new Fields(); ! f.intI = 3; ! f.stringI = "Instance field is: "; ! println(f.stringI + f.intI); ! String s = f.fieldsList[0]; assert (s.equals("First")); } --- 37,46 ---- println(Fields.stringS + Fields.intS); ! Fields fields = new Fields(); ! fields.intI = 3; ! fields.stringI = "Instance field is: "; ! println(fields.stringI + fields.intI); ! String s = fields.fieldsList[0]; assert (s.equals("First")); } Index: methods.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/methods.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** methods.nice 2 Apr 2003 15:56:18 -0000 1.3 --- methods.nice 15 Jun 2003 12:58:30 -0000 1.4 *************** *** 7,11 **** name(c@C1) = "C1"; name(c@C2) = "C2"; ! name(@null) = "NULL class"; void test_methods(); --- 7,11 ---- name(c@C1) = "C1"; name(c@C2) = "C2"; ! name(null) = "NULL class"; void test_methods(); Index: generic.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/generic.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** generic.nice 30 Oct 2001 15:27:03 -0000 1.2 --- generic.nice 15 Jun 2003 12:58:30 -0000 1.3 *************** *** 12,16 **** void setX_meth(T value); ! setX_meth<T>(value) { T tmp = value; --- 12,16 ---- void setX_meth(T value); ! <T> setX_meth(value) { T tmp = value; Index: constants.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/constants.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** constants.nice 4 Mar 2002 11:30:53 -0000 1.2 --- constants.nice 15 Jun 2003 12:58:30 -0000 1.3 *************** *** 19,24 **** void test_constants() { ! final int x = 1; ! const long y = x + 1; ! const z = (y == x); } --- 19,24 ---- void test_constants() { ! let int x = 1; ! let long y = x + 1; ! let z = (y == x); } Index: classes.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/classes.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** classes.nice 9 May 2002 13:55:55 -0000 1.12 --- classes.nice 15 Jun 2003 12:58:30 -0000 1.13 *************** *** 45,56 **** */ String pToString(?String); ! pToString(s@null(String)) = "Null string"; pToString(s@String) = "String"; <Any T> boolean isNull(T); isNull(x) = false; ! isNull(@null) = true; ! pToString(@null(Point)) = "Origin"; boolean isSimplePoint(Point); --- 45,56 ---- */ String pToString(?String); ! pToString(null(String)) = "Null string"; pToString(s@String) = "String"; <Any T> boolean isNull(T); isNull(x) = false; ! isNull(null) = true; ! pToString(null(Point)) = "Origin"; boolean isSimplePoint(Point); *************** *** 75,80 **** println(new Point(x:0,y:0).toString()); println(new ColoredPoint(x:0,y:0,c:0).toString()); ! Point p = new ColoredPoint(x:0,y:0,c:0); ! println(p.toString()); new TestFieldInitializers(); --- 75,80 ---- println(new Point(x:0,y:0).toString()); println(new ColoredPoint(x:0,y:0,c:0).toString()); ! Point pt = new ColoredPoint(x:0,y:0,c:0); ! println(pt.toString()); new TestFieldInitializers(); Index: arrays.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/arrays.nice,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** arrays.nice 11 Jun 2003 12:21:28 -0000 1.20 --- arrays.nice 15 Jun 2003 12:58:30 -0000 1.21 *************** *** 19,23 **** while it would be rawArray if the domain of the method was bigger. */ ! reverse<T>(a@Array) { T[] res = fill(new T[a.length], int i => a[a.length - i - 1]); --- 19,23 ---- while it would be rawArray if the domain of the method was bigger. */ ! <T> reverse(a@Array) { T[] res = fill(new T[a.length], int i => a[a.length - i - 1]); *************** *** 147,151 **** float[] tf = [ 1.5, 2, 3.7 ]; ! tf.iter( float f =>println(f+1)); } --- 147,151 ---- float[] tf = [ 1.5, 2, 3.7 ]; ! tf.iter(float fl => println(fl + 1)); } |
From: <bo...@us...> - 2003-06-15 12:54:26
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv26958/src/bossa/parser Modified Files: Parser.jj Log Message: Report name@literal deprecation warning at the correct position. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.185 retrieving revision 1.186 diff -C2 -d -r1.185 -r1.186 *** Parser.jj 14 Jun 2003 17:43:45 -0000 1.185 --- Parser.jj 15 Jun 2003 12:54:23 -0000 1.186 *************** *** 1227,1232 **** ( val=patternLiteral() ! { User.warning(val, ! "This syntax is deprecated.\n" +"leave '"+ name+"@' away.");} | tc=typeIdent() --- 1227,1232 ---- ( val=patternLiteral() ! { User.warning(name, ! "This syntax is deprecated.\n" + "Leave '"+ name+"@' away.");} | tc=typeIdent() |
From: <ar...@us...> - 2003-06-15 11:52:21
|
Update of /cvsroot/nice/Nice/stdlib/nice/getopt In directory sc8-pr-cvs1:/tmp/cvs-serv17248/F:/nice/stdlib/nice/getopt Modified Files: getopt.nice gnugetopt.nice options.nice Log Message: Minor cleanups of the getopt part(attempt #2). Index: getopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/getopt.nice,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** getopt.nice 13 Jun 2003 20:34:41 -0000 1.18 --- getopt.nice 15 Jun 2003 11:52:17 -0000 1.19 *************** *** 53,57 **** // Parsing loop char c = g.getopt(); ! while (c != '\1') { ?Option chosen = options.find(Option o => o.optval == c); --- 53,57 ---- // Parsing loop char c = g.getopt(); ! while (c != noOptionsLeft) { ?Option chosen = options.find(Option o => o.optval == c); Index: gnugetopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/gnugetopt.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gnugetopt.nice 13 Jun 2003 20:34:41 -0000 1.5 --- gnugetopt.nice 15 Jun 2003 11:52:17 -0000 1.6 *************** *** 25,28 **** --- 25,31 ---- import java.text.*; + let char noOptionsLeft = '\1'; + let char undefinedOption = '\0'; + public class Getopt { *************** *** 163,176 **** exact = false; longind = -1; ! nameend = (nextchar || "").indexOf("="); if (nameend == -1) ! nameend = (nextchar || "").length(); // Test all lnog options for either exact match or abbreviated matches for (int i = 0; i < long_options.length; i++) { ! if (long_options[i].getName().startsWith((nextchar || "").substring(0, nameend))) { ! if (long_options[i].getName().equals((nextchar || "").substring(0, nameend))) { // Exact match found --- 166,179 ---- exact = false; longind = -1; ! nameend = notNull(nextchar).indexOf("="); if (nameend == -1) ! nameend = notNull(nextchar).length(); // Test all lnog options for either exact match or abbreviated matches for (int i = 0; i < long_options.length; i++) { ! if (long_options[i].getName().startsWith(notNull(nextchar).substring(0, nameend))) { ! if (long_options[i].getName().equals(notNull(nextchar).substring(0, nameend))) { // Exact match found *************** *** 201,205 **** nextchar = ""; ! optopt = '\0'; ++optind; return '?'; --- 204,208 ---- nextchar = ""; ! optopt = undefinedOption; ++optind; return '?'; *************** *** 210,219 **** ++optind; ! if (nameend != (nextchar || "").length()) { if (pfound.has_arg != NO_ARGUMENT) { ! if ((nextchar || "").substring(nameend).length() > 1) ! optarg = (nextchar || "").substring(nameend+1); else optarg = ""; --- 213,222 ---- ++optind; ! if (nameend != notNull(nextchar).length()) { if (pfound.has_arg != NO_ARGUMENT) { ! if (notNull(nextchar).substring(nameend).length() > 1) ! optarg = notNull(nextchar).substring(nameend+1); else optarg = ""; *************** *** 260,264 **** sb.setLength(0); sb.append(pfound.val); ! return '\0'; } --- 263,267 ---- sb.setLength(0); sb.append(pfound.val); ! return undefinedOption; } *************** *** 268,272 **** longopt_handled = false; ! return '\0'; } --- 271,275 ---- longopt_handled = false; ! return undefinedOption; } *************** *** 276,280 **** if (endparse == true) ! return '\1'; if ((nextchar == null) || (nextchar.equals(""))) --- 279,283 ---- if (endparse == true) ! return noOptionsLeft; if ((nextchar == null) || (nextchar.equals(""))) *************** *** 333,337 **** optind = first_nonopt; ! return '\1'; } --- 336,340 ---- optind = first_nonopt; ! return noOptionsLeft; } *************** *** 342,346 **** { if (ordering == REQUIRE_ORDER) ! return '\1'; optarg = argv[optind++]; --- 345,349 ---- { if (ordering == REQUIRE_ORDER) ! return noOptionsLeft; optarg = argv[optind++]; *************** *** 384,388 **** // Otherwise interpret it as a short option. if (!long_only || argv[optind].startsWith("--") ! || (optstring.indexOf((nextchar || "").charAt(0)) == -1)) { if (opterr) --- 387,391 ---- // Otherwise interpret it as a short option. if (!long_only || argv[optind].startsWith("--") ! || (optstring.indexOf(notNull(nextchar).charAt(0)) == -1)) { if (opterr) *************** *** 396,400 **** nextchar = ""; ++optind; ! optopt = '\0'; return '?'; } --- 399,403 ---- nextchar = ""; ++optind; ! optopt = undefinedOption; return '?'; } *************** *** 402,408 **** // Look at and handle the next short option-character */ ! char c = notNull(nextchar).charAt(0); //**** Do we need to check for empty str? ! if ((nextchar || "").length() > 1) ! nextchar = (nextchar || "").substring(1); else nextchar = ""; --- 405,411 ---- // Look at and handle the next short option-character */ ! char c = notNull(nextchar).charAt(0); ! if (notNull(nextchar).length() > 1) ! nextchar = notNull(nextchar).substring(1); else nextchar = ""; Index: options.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/options.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** options.nice 13 Jun 2003 20:34:41 -0000 1.8 --- options.nice 15 Jun 2003 11:52:17 -0000 1.9 *************** *** 50,54 **** String longName; String purpose; ! char optval = '\0'; boolean visible; --- 50,54 ---- String longName; String purpose; ! char optval = undefinedOption; boolean visible; |
From: <ar...@us...> - 2003-06-15 11:28:57
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv14223/F:/nice/debian Modified Files: changelog Log Message: Update the change log about dispatch on global constants. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.175 retrieving revision 1.176 diff -C2 -d -r1.175 -r1.176 *** changelog 14 Jun 2003 12:05:07 -0000 1.175 --- changelog 15 Jun 2003 11:28:53 -0000 1.176 *************** *** 15,21 **** * The 'char' type is no longer a subtype of int. The integer unicode representation of a character c can be obtained by int(c). ! * Added dispatch on global constants which value is a literal. * Redefining of local variables in their scope is not allowed anymore. ! * Bugfixes (Parsing of nested tuples, global constants of type char ...) * Improved some error messages. --- 15,34 ---- * The 'char' type is no longer a subtype of int. The integer unicode representation of a character c can be obtained by int(c). ! * Added dispatch on global constants which value is a literal. example: ! let int specialValue = 7; ! void foo(int); ! foo(n) { /*do something*/ } ! foo(=specialValue) { /*do something else*/ } * Redefining of local variables in their scope is not allowed anymore. ! * Dispatch on global constants works also for unique references(new Objects). ! class Color {} ! let Color red = new Color(); ! let Color blue = new Color(); ! String name(Color); ! name(color) = "unknown color"; ! name(=red) = "red"; ! name(=blue) = "blue"; ! * Bugfixes (Parsing of nested tuples, global constants of type char, ! Overloading resolving of methods implementation with additional tc's, ...) * Improved some error messages. |
From: <ar...@us...> - 2003-06-15 11:11:58
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv12439/F:/nice/src/bossa/syntax Modified Files: MethodBodyDefinition.java Log Message: minor cleanup. Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** MethodBodyDefinition.java 15 Jun 2003 10:01:43 -0000 1.128 --- MethodBodyDefinition.java 15 Jun 2003 11:11:56 -0000 1.129 *************** *** 230,233 **** --- 230,234 ---- symbols.toArray(tempSymbols); int size = symbols.size(); + symbols = new LinkedList(); int len = formals.length; boolean[] removed = new boolean[size]; *************** *** 235,239 **** { Monotype[] dom1 = tempSymbols[m1].getDefinition().getType().domain(); ! for (int m2 = 0; m2 < size && !removed[m1]; m2++) if (m1 != m2) { --- 236,240 ---- { Monotype[] dom1 = tempSymbols[m1].getDefinition().getType().domain(); ! for (int m2 = 0; m2 < size; m2++) if (m1 != m2) { *************** *** 241,270 **** boolean additionalsEqual = true; Monotype[] dom2 = tempSymbols[m2].getDefinition().getType().domain(); ! for (int i = 0; i < len && remove; i++) ! { ! try { ! domainMonotypeLeq(dom2[i], dom1[i]); ! try { ! domainMonotypeLeq(dom1[i], dom2[i]); ! } ! catch (TypingEx e) { ! if (additionalTags[i] != null) additionalsEqual = false; } } ! catch(TypingEx e) { ! //ignore arguments with additional. ! remove = additionalTags[i] == null; ! } ! } //may not remove a method that is equal for the arguments with an additional. removed[m1] = remove && !additionalsEqual; } } - symbols = new LinkedList(); - for (int i = 0; i < size; i++) - if (!removed[i]) - symbols.add(tempSymbols[i]); } --- 242,273 ---- boolean additionalsEqual = true; Monotype[] dom2 = tempSymbols[m2].getDefinition().getType().domain(); ! for (int i = 0; i < len; i++) ! if (additionalTags[i] != null) ! { ! try { ! domainMonotypeLeq(dom2[i], dom1[i]); ! try { ! domainMonotypeLeq(dom1[i], dom2[i]); ! } ! catch (TypingEx e) { additionalsEqual = false; + } + } + catch(TypingEx e) { + remove = false; + break; } } ! //may not remove a method that is equal for the arguments with an additional. removed[m1] = remove && !additionalsEqual; + if (removed[m1]) + break; } + + if (!removed[m1]) + symbols.add(tempSymbols[m1]); } } |