[Nice-commit] Nice/src/bossa/syntax ident.nice,NONE,1.1 Contract.java,1.10,1.11 analyse.nice,1.116,1
Brought to you by:
bonniot
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19096/F:/nice/src/bossa/syntax Modified Files: Contract.java analyse.nice assign.nice dispatch.java.bootstrap enum.nice loop.nice Added Files: ident.nice Removed Files: IdentExp.java Log Message: Converted IdentExp. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** analyse.nice 4 Dec 2004 19:38:18 -0000 1.116 --- analyse.nice 7 Dec 2004 17:33:57 -0000 1.117 *************** *** 478,482 **** Expression analyseIdent(IdentExp e, Info info, boolean assigned) { ! if (!e.infix) // infix symbols can only come from the global scope { ?VarSymbol sym = info.lookup(notNull(e.ident).toString()); --- 478,482 ---- Expression analyseIdent(IdentExp e, Info info, boolean assigned) { ! if (!e.isInfix()) // infix symbols can only come from the global scope { ?VarSymbol sym = info.lookup(notNull(e.ident).toString()); *************** *** 508,512 **** ?List<VarSymbol> symbols; ! if (e.infix) symbols = cast(notNull(Node.getGlobalScope()).lookup(e.ident)); else --- 508,512 ---- ?List<VarSymbol> symbols; ! if (e.isInfix()) symbols = cast(notNull(Node.getGlobalScope()).lookup(e.ident)); else Index: loop.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/loop.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** loop.nice 13 Oct 2004 20:42:21 -0000 1.5 --- loop.nice 7 Dec 2004 17:33:57 -0000 1.6 *************** *** 140,149 **** } ! let getiter = createCallExp(new IdentExp(new LocatedString("forIterator", loc)), container); let iter = new LocatedString(loc.uniqueIdentifier("for_in_iter_"), loc); let init = new LocalVariable(iter, itertype, true, getiter); ! let iterexp = new IdentExp(iter); ! let cond = createCallExp(new IdentExp(new LocatedString("hasNext", loc)), iterexp); ! let getvar = createCallExp(new IdentExp(new LocatedString("next", loc)), iterexp); let assign = new LocalVariable(varName, vartype, true, getvar); let loop = createWhileLoop(cond, createBlock(new LinkedList([assign, body]))); --- 140,149 ---- } ! let getiter = createCallExp(createIdentExp(new LocatedString("forIterator", loc)), container); let iter = new LocatedString(loc.uniqueIdentifier("for_in_iter_"), loc); let init = new LocalVariable(iter, itertype, true, getiter); ! let iterexp = createIdentExp(iter); ! let cond = createCallExp(createIdentExp(new LocatedString("hasNext", loc)), iterexp); ! let getvar = createCallExp(createIdentExp(new LocatedString("next", loc)), iterexp); let assign = new LocalVariable(varName, vartype, true, getvar); let loop = createWhileLoop(cond, createBlock(new LinkedList([assign, body]))); Index: assign.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/assign.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** assign.nice 13 Oct 2004 23:22:22 -0000 1.4 --- assign.nice 7 Dec 2004 17:33:57 -0000 1.5 *************** *** 45,49 **** return createCallExp( ! new IdentExp(new LocatedString("set", to.function.location())), new Arguments(args)); } --- 45,49 ---- return createCallExp( ! createIdentExp(new LocatedString("set", to.function.location())), new Arguments(args)); } Index: enum.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/enum.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** enum.nice 1 Dec 2004 02:00:32 -0000 1.6 --- enum.nice 7 Dec 2004 17:33:57 -0000 1.7 *************** *** 80,84 **** globalDefs.add(createMethodBodyDefinition(impl, new LocatedString("family"), null, new LinkedList(), createReturnStmt(createLiteralArrayExp( ! elements.map(LocatedString elem => new IdentExp(elem))), true))); //generate the prettyprint string --- 80,84 ---- globalDefs.add(createMethodBodyDefinition(impl, new LocatedString("family"), null, new LinkedList(), createReturnStmt(createLiteralArrayExp( ! elements.map(createIdentExp)), true))); //generate the prettyprint string Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** dispatch.java.bootstrap 4 Dec 2004 19:38:18 -0000 1.29 --- dispatch.java.bootstrap 7 Dec 2004 17:33:57 -0000 1.30 *************** *** 13,16 **** --- 13,19 ---- public class dispatch { + public static Expression createIdentExp(LocatedString i) + { return null; } + public static Expression createSymbolExp(VarSymbol symbol, bossa.util.Location loc) { return null; } Index: Contract.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Contract.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Contract.java 13 Oct 2004 20:42:21 -0000 1.10 --- Contract.java 7 Dec 2004 17:33:57 -0000 1.11 *************** *** 73,77 **** private Expression symbol(String name, Located loc) { ! return new IdentExp(new LocatedString(name, loc.location())); } --- 73,77 ---- private Expression symbol(String name, Located loc) { ! return dispatch.createIdentExp(new LocatedString(name, loc.location())); } --- NEW FILE: ident.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; import bossa.util.*; /** Identifier supposed to be a variable (not a type). */ public class IdentExp extends Expression { final LocatedString ident; private boolean infix = false; /** Resolve to a ClassExp or a PackageExp if ident is not known. */ boolean enableClassExp = false; /** Force production of overloaded symbol exp, even if there is just one case. */ boolean alwaysOverloadedSymbol = false; computeType() { Internal.error(this, "computeType in IdentExp (" + this + ")"); } compile() { throw Internal.error("compile in IdentExp"); } toString() = ident.toString(); toString(param) { if (param == Printable.parsable) return "`" + ident.toString() + "`"; return this.toString(); } /** This ident is the function part of an infix call. */ boolean isInfix() = infix; void setInfix() { infix = true; } } public Expression createIdentExp(LocatedString i) { let res = new IdentExp(ident: i); res.setLocation(i.location()); return res; } --- IdentExp.java DELETED --- |