pizzacompiler-commits Mailing List for Pizza
Brought to you by:
nfortescue
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(33) |
Oct
(13) |
Nov
(3) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(2) |
Feb
(4) |
Mar
(5) |
Apr
|
May
(2) |
Jun
|
Jul
(9) |
Aug
|
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(2) |
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Nick F. <nfo...@us...> - 2004-08-09 10:48:33
|
Update of /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4852/tests/src/unit/net/sf/pizzacompiler/compiler Modified Files: AllUnitTests.java ScannerTest.java Added Files: ParserTest.java Log Message: added a test for the Parser, while investigating a reported bug (which wasn't a bug) --- NEW FILE: ParserTest.java --- package net.sf.pizzacompiler.compiler; import java.io.ByteArrayInputStream; import java.io.IOException; import junit.framework.TestCase; import net.sf.pizzacompiler.CompilerTestMethods; /** * $Id: ParserTest.java,v 1.1 2004/08/09 10:48:14 nfortescue Exp $ * Copyright (C) 2004 Nicolas Fortescue. * This software is distributed under the Artistic License. See * artistic.html or artistic.txt which came with this distribution. * * Created: 09-Aug-2004 11:32:04 * * @author Nick Fortescue */ public class ParserTest extends TestCase { public ParserTest(String s) { super(s); } public void testAssignmentInTertiary() throws IOException { // check ok in java int i = 10; int j = (i == 10) ? (i = 20) : (i = 40); assertEquals(20, j); assertEquals(20, i); // check ok in pizza final String source = "/**/\npublic class Foo {public int foo(int i) {return (i==10) ? (i=20) : (i=40);}}\n"; final String encoding = "US-ASCII"; final ByteArrayInputStream stream = new ByteArrayInputStream(source.getBytes(encoding)); String output = CompilerTestMethods.collectOutput(new Runnable() { public void run() { Scanner scanner = new Scanner(stream, encoding); Parser parser = new Parser(scanner); parser.compilationUnit(); } }); assertEquals("", output); } } Index: AllUnitTests.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler/AllUnitTests.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AllUnitTests.java 9 Aug 2004 10:29:55 -0000 1.8 --- AllUnitTests.java 9 Aug 2004 10:48:14 -0000 1.9 *************** *** 24,27 **** --- 24,28 ---- suite.addTest(new TestSuite(MapSourceReaderTest.class)); suite.addTest(new TestSuite(MultipleCatchTest.class)); + suite.addTest(new TestSuite(ParserTest.class)); suite.addTest(new TestSuite(PositionTest.class)); suite.addTest(new TestSuite(ReportTest.class)); Index: ScannerTest.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler/ScannerTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ScannerTest.java 9 Aug 2004 10:29:55 -0000 1.1 --- ScannerTest.java 9 Aug 2004 10:48:14 -0000 1.2 *************** *** 23,27 **** public void testShortComment() throws IOException { ! final String source = "/**/\npubli class Foo {}\n"; final String encoding = "US-ASCII"; final ByteArrayInputStream stream = new ByteArrayInputStream(source.getBytes(encoding)); --- 23,27 ---- public void testShortComment() throws IOException { ! final String source = "/**/\npublic class Foo {}\n"; final String encoding = "US-ASCII"; final ByteArrayInputStream stream = new ByteArrayInputStream(source.getBytes(encoding)); *************** *** 36,40 **** public void testStarComment() throws IOException { ! final String source = "/***/\npubli class Foo {}\n"; final String encoding = "US-ASCII"; final ByteArrayInputStream stream = new ByteArrayInputStream(source.getBytes(encoding)); --- 36,40 ---- public void testStarComment() throws IOException { ! final String source = "/***/\npublic class Foo {}\n"; final String encoding = "US-ASCII"; final ByteArrayInputStream stream = new ByteArrayInputStream(source.getBytes(encoding)); |
From: Nick F. <nfo...@us...> - 2004-08-09 10:30:08
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2702/main/src/net/sf/pizzacompiler/compiler Modified Files: Parser.pizza Scanner.pizza Log Message: fixed defect 632663, /**/ now works Index: Parser.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/Parser.pizza,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Parser.pizza 6 Dec 2001 11:46:37 -0000 1.2 --- Parser.pizza 9 Aug 2004 10:29:55 -0000 1.3 *************** *** 17,715 **** class Parser implements /* imports */ Constants { ! /** syntax class tags: ! */ ! private static final int TYPE = 1; ! private static final int EXPR = 2; ! private static final int PATT = 4; ! private static final int STAT = 8; ! /** the number of precedence levels of infix operators: [...3460 lines suppressed...] ! /** ! * create postfix operation: ! */ ! private AST makePostop(int pos, int token, AST od) { ! int op; ! switch (token) { ! case PlusPlus: ! op = POSTINC; ! break; ! case MinusMinus: ! op = POSTDEC; ! break; ! default: ! throw new InternalError(); } + return ASTgen.at(pos).Unop(op, od); + } } Index: Scanner.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/Scanner.pizza,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Scanner.pizza 9 Dec 2002 11:54:37 -0000 1.4 --- Scanner.pizza 9 Aug 2004 10:29:55 -0000 1.5 *************** *** 11,61 **** import net.sf.pizzacompiler.pizzadoc.DocCollector; import java.io.*; class Scanner implements /* imports */ Constants { ! /** Layout & character constants: ! */ ! final static int tabinc = 8; ! final static char LF = 0xA; ! final static char FF = 0xC; [...1686 lines suppressed...] ! enterKeyword("short", ShortTk); ! enterKeyword("void", VoidTk); ! enterKeyword("null", NullTk); ! enterKeyword("strictfp", StrictfpTk); ! if (Switches.source14) enterKeyword("assert", AssertTk); ! standardMaxKey = maxKey; ! enterKeyword("fun", FunTk); ! if (Switches.experimental) enterKeyword("seq", SeqTk); ! enterKeyword("->", RightArrow); ! enterKeyword("_", Underscore); ! extendedMaxKey = maxKey; ! key = new byte[maxKey + 1]; ! for (int i = 0; i <= maxKey; i++) key[i] = Id; ! for (byte j = 0; j < TokenCount; j++) ! if (tokenName[j] != null) key[tokenName[j].index] = j; ! } } |
From: Nick F. <nfo...@us...> - 2004-08-09 10:30:07
|
Update of /cvsroot/pizzacompiler/pizza/tests/src/acceptance/net/sf/pizzacompiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2702/tests/src/acceptance/net/sf/pizzacompiler Modified Files: ArrayTest.java Log Message: fixed defect 632663, /**/ now works Index: ArrayTest.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/acceptance/net/sf/pizzacompiler/ArrayTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ArrayTest.java 9 Aug 2004 09:56:06 -0000 1.2 --- ArrayTest.java 9 Aug 2004 10:29:55 -0000 1.3 *************** *** 94,97 **** assertTrue(result.booleanValue()); } - }// ArrayTest --- 94,96 ---- |
From: Nick F. <nfo...@us...> - 2004-08-09 10:30:04
|
Update of /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2702/tests/src/unit/net/sf/pizzacompiler/compiler Modified Files: AllUnitTests.java Added Files: ScannerTest.java Log Message: fixed defect 632663, /**/ now works --- NEW FILE: ScannerTest.java --- package net.sf.pizzacompiler.compiler; import java.io.ByteArrayInputStream; import java.io.IOException; import junit.framework.TestCase; import net.sf.pizzacompiler.CompilerTestMethods; /** * $Id: ScannerTest.java,v 1.1 2004/08/09 10:29:55 nfortescue Exp $ * * Copyright (C) 2004 Nicolas Fortescue. * This software is distributed under the Artistic License. See * artistic.html or artistic.txt which came with this distribution. * * @author Nick Fortescue * Created: 09-Aug-2004 10:59:16 */ public class ScannerTest extends TestCase { public ScannerTest(String s) { super(s); } public void testShortComment() throws IOException { final String source = "/**/\npubli class Foo {}\n"; final String encoding = "US-ASCII"; final ByteArrayInputStream stream = new ByteArrayInputStream(source.getBytes(encoding)); String output = CompilerTestMethods.collectOutput(new Runnable() { public void run() { Scanner scanner = new Scanner(stream, encoding); scanner.nexttoken(); } }); assertEquals("", output); } public void testStarComment() throws IOException { final String source = "/***/\npubli class Foo {}\n"; final String encoding = "US-ASCII"; final ByteArrayInputStream stream = new ByteArrayInputStream(source.getBytes(encoding)); String output = CompilerTestMethods.collectOutput(new Runnable() { public void run() { Scanner scanner = new Scanner(stream, encoding); scanner.nexttoken(); } }); assertEquals("", output); } } Index: AllUnitTests.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler/AllUnitTests.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AllUnitTests.java 25 Jul 2002 08:30:58 -0000 1.7 --- AllUnitTests.java 9 Aug 2004 10:29:55 -0000 1.8 *************** *** 1,33 **** ! package net.sf.pizzacompiler.compiler; ! ! /** ! * $Id$ ! * ! * Copyright (C) 2001 Nicolas Fortescue. ! * This software is distributed under the Artistic License. See ! * artistic.html or artistic.txt which came with this distribution. ! * ! */ ! ! import junit.framework.*; ! ! public class AllUnitTests extends TestSuite { ! ! public static Test suite() { ! TestSuite suite = new TestSuite(); ! suite.addTest(new TestSuite(BasicTest.class)); ! suite.addTest(new TestSuite(ClassReaderTest.class)); ! suite.addTest(new TestSuite(ErrorMessageTest.class)); ! suite.addTest(new TestSuite(FileCompilerOutputTest.class)); ! suite.addTest(new TestSuite(InnerClassStaticVarTest.class)); ! suite.addTest(new TestSuite(MainTest.class)); ! suite.addTest(new TestSuite(MapSourceReaderTest.class)); ! suite.addTest(new TestSuite(MultipleCatchTest.class)); ! suite.addTest(new TestSuite(PositionTest.class)); ! suite.addTest(new TestSuite(ReportTest.class)); ! suite.addTest(new TestSuite(SwitchesTest.class)); ! suite.addTest(new TestSuite(TypeTest.class)); ! suite.addTest(new TestSuite(ZipFileDirectoryTest.class)); ! return suite; ! } ! }// AllUnitTests --- 1,34 ---- ! package net.sf.pizzacompiler.compiler; ! ! /** ! * $Id$ ! * ! * Copyright (C) 2001 Nicolas Fortescue. ! * This software is distributed under the Artistic License. See ! * artistic.html or artistic.txt which came with this distribution. ! * ! */ ! ! import junit.framework.*; ! ! public class AllUnitTests extends TestSuite { ! ! public static Test suite() { ! TestSuite suite = new TestSuite(); ! suite.addTest(new TestSuite(BasicTest.class)); ! suite.addTest(new TestSuite(ClassReaderTest.class)); ! suite.addTest(new TestSuite(ErrorMessageTest.class)); ! suite.addTest(new TestSuite(FileCompilerOutputTest.class)); ! suite.addTest(new TestSuite(InnerClassStaticVarTest.class)); ! suite.addTest(new TestSuite(MainTest.class)); ! suite.addTest(new TestSuite(MapSourceReaderTest.class)); ! suite.addTest(new TestSuite(MultipleCatchTest.class)); ! suite.addTest(new TestSuite(PositionTest.class)); ! suite.addTest(new TestSuite(ReportTest.class)); ! suite.addTest(new TestSuite(SwitchesTest.class)); ! suite.addTest(new TestSuite(ScannerTest.class)); ! suite.addTest(new TestSuite(TypeTest.class)); ! suite.addTest(new TestSuite(ZipFileDirectoryTest.class)); ! return suite; ! } ! }// AllUnitTests |
From: Nick F. <nfo...@us...> - 2004-08-09 09:56:20
|
Update of /cvsroot/pizzacompiler/pizza/tests/src/acceptance/net/sf/pizzacompiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30165/tests/src/acceptance/net/sf/pizzacompiler Modified Files: ArrayTest.java ClassAndSourceOutputTests.java Log Message: fixed defect 788732, arrays now implements Serializable, Cloneable Index: ArrayTest.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/acceptance/net/sf/pizzacompiler/ArrayTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ArrayTest.java 8 Mar 2002 19:47:04 -0000 1.1 --- ArrayTest.java 9 Aug 2004 09:56:06 -0000 1.2 *************** *** 1,47 **** ! package net.sf.pizzacompiler; ! ! /** ! * $Id$ ! * ! * Copyright (C) 2001 Nicolas Fortescue. ! * This software is distributed under the Artistic License. See ! * artistic.html or artistic.txt which came with this distribution. ! * ! * Created: Fri Mar 08 19:27:41 2002 ! */ ! ! import junit.framework.TestCase; ! ! import net.sf.pizzacompiler.compiler.ByteArrayClassLoader; ! ! import java.lang.reflect.Method; ! import java.util.*; ! ! public class ArrayTest extends TestCase { ! public ArrayTest(String s){ ! super(s); ! } ! ! private static final String ARRAYCLASSNAME = "ArrayCode"; ! private static final String CLONEMETHOD = "cloneArray"; ! private static final String arraySource = ! "public class "+ARRAYCLASSNAME+" {\n" + ! " public static int [] "+CLONEMETHOD+"(int[] array) {\n" + ! " return (int[])array.clone();\n" + ! " }\n"+ ! "}\n"; ! ! public void testClone() throws Exception { ! byte [] code = CompilerTestMethods.compileSourceToBytes(ARRAYCLASSNAME, arraySource, false); ! ClassLoader cl = ! new ByteArrayClassLoader(this.getClass().getClassLoader(), ! Collections.singleton(code)); ! Class clazz = cl.loadClass(ARRAYCLASSNAME); ! int [] original = new int[]{1,2,3}; ! Method method = clazz.getMethod(CLONEMETHOD, new Class[]{original.getClass()}); ! int [] result = (int [])method.invoke(null, new Object[]{original}); ! assertTrue(original != result); ! assertTrue(Arrays.equals(original, result)); ! } ! ! }// ArrayTest --- 1,97 ---- ! package net.sf.pizzacompiler; ! ! /** ! * $Id$ ! * ! * Copyright (C) 2001 Nicolas Fortescue. ! * This software is distributed under the Artistic License. See ! * artistic.html or artistic.txt which came with this distribution. ! * ! * Created: Fri Mar 08 19:27:41 2002 ! */ ! ! import java.lang.reflect.Method; ! import java.util.*; ! ! import junit.framework.TestCase; ! import net.sf.pizzacompiler.compiler.ByteArrayClassLoader; ! ! public class ArrayTest extends TestCase { ! public ArrayTest(String s){ ! super(s); ! } ! ! private static final String CLASSNAME = "ArrayCode"; ! private static final String METHOD = "doIt"; ! private static final String cloneSource = ! "public class "+CLASSNAME+" {\n" + ! " public static int [] "+METHOD+"(int[] array) {\n" + ! " return (int[])array.clone();\n" + ! " }\n"+ ! "}\n"; ! ! public void testClone() throws Exception { ! byte [] code = CompilerTestMethods.compileSourceToBytes(CLASSNAME, cloneSource, false); ! ClassLoader cl = ! new ByteArrayClassLoader(this.getClass().getClassLoader(), ! Collections.singleton(code)); ! Class clazz = cl.loadClass(CLASSNAME); ! int [] original = new int[]{1,2,3}; ! Method method = clazz.getMethod(METHOD, new Class[]{original.getClass()}); ! int [] result = (int [])method.invoke(null, new Object[]{original}); ! assertTrue(original != result); ! assertTrue(Arrays.equals(original, result)); ! } ! ! private static final String cloneableSource = ! "public class "+CLASSNAME+" {\n" + ! " public Cloneable "+METHOD+"() {\n" + ! " return new String[0];\n" + ! " }\n"+ ! "}\n"; ! /** ! * Arrays should implement Cloneable ! * @throws Exception ! */ ! public void testCloneable() throws Exception { ! byte [] code = CompilerTestMethods.compileSourceToBytes(CLASSNAME, cloneableSource, false); ! ClassLoader cl = ! new ByteArrayClassLoader(this.getClass().getClassLoader(), Collections.singleton(code)); ! cl.loadClass(CLASSNAME); ! } ! ! private static final String serializableSource = ! "public class "+CLASSNAME+" {\n" + ! " public java.io.Serializable "+METHOD+"() {\n" + ! " return new String[0];\n" + ! " }\n"+ ! "}\n"; ! /** ! * Arrays should implement Cloneable ! * @throws Exception ! */ ! public void testSerializable() throws Exception { ! byte [] code = CompilerTestMethods.compileSourceToBytes(CLASSNAME, serializableSource, false); ! ClassLoader cl = ! new ByteArrayClassLoader(this.getClass().getClassLoader(), Collections.singleton(code)); ! cl.loadClass(CLASSNAME); ! } ! ! private static final String implementsSerializableSource = ! "public class "+CLASSNAME+" {\n" + ! " public static boolean "+METHOD+"() {\n" + ! " return ((new String[0]) instanceof Cloneable) && ((new String[0]) instanceof Cloneable);\n" + ! " }\n"+ ! "}\n"; ! public void testImplementsCloneable() throws Exception { ! byte [] code = CompilerTestMethods.compileSourceToBytes(CLASSNAME, implementsSerializableSource, false); ! ClassLoader cl = ! new ByteArrayClassLoader(this.getClass().getClassLoader(), ! Collections.singleton(code)); ! Class clazz = cl.loadClass(CLASSNAME); ! Method method = clazz.getMethod(METHOD, new Class[0]); ! Boolean result = (Boolean)method.invoke(null, new Object[0]); ! assertTrue(result.booleanValue()); ! } ! ! }// ArrayTest Index: ClassAndSourceOutputTests.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/acceptance/net/sf/pizzacompiler/ClassAndSourceOutputTests.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ClassAndSourceOutputTests.java 14 Sep 2001 13:12:55 -0000 1.2 --- ClassAndSourceOutputTests.java 9 Aug 2004 09:56:06 -0000 1.3 *************** *** 1,65 **** ! package net.sf.pizzacompiler; ! ! /** ! * $Id$ ! * ! * Copyright (C) 2001 Nicolas Fortescue. ! * This software is distributed under the Artistic License. See ! * artistic.html or artistic.txt which came with this distribution. ! * ! * Created: Thu Sep 13 15:36:05 2001 ! */ ! ! import junit.framework.*; ! import java.io.File; ! import java.io.IOException; ! ! public class ClassAndSourceOutputTests extends TestCase { ! public ClassAndSourceOutputTests(String s) { ! super(s); ! } ! ! final String GOOD_FILE = "APizzaClassTestCode.java"; ! final String WARNING_FILE = "UnreachableCodeTestCode.java"; ! final String BAD_FILE = "UnreachableCodeTestCode.java"; ! ! public void testClassesGetWrittenIfWarningOccurs() throws IOException { ! testNFilesGetWritten(WARNING_FILE, new String[0], 1); ! } ! public void testClassesDontGetWrittenIfErrorOccurs() throws IOException { ! testNFilesGetWritten(BAD_FILE, new String[0], 1); ! } ! ! public void testClassesWrittenToChosenDir() throws IOException { ! testNFilesGetWritten(GOOD_FILE, new String[0], 1); ! } ! ! public void testSourceWrittenToChosenDir() throws IOException { ! testNFilesGetWritten(GOOD_FILE, new String[]{"-s"}, 1); ! } ! ! private void testNFilesGetWritten(String filename, String [] args, ! int nrFiles) ! throws IOException { ! ! File tempDir = CompilerTestMethods.makeTempDirectory(); ! try { ! assertEquals(0, tempDir.listFiles().length); ! File source = ! CompilerTestMethods.findTestFile(this, filename); ! final String [] myArgs = ! new String[]{"-pizza", "-d", tempDir.getAbsolutePath()}; ! String [] allArgs = new String[args.length+myArgs.length]; ! System.arraycopy(args, 0, allArgs, 0, args.length); ! System.arraycopy(myArgs, 0, allArgs, args.length, myArgs.length); ! CompilerTestMethods.compilerOutput(source, allArgs); ! ! File [] files = tempDir.listFiles(); ! assertEquals(files.length == 0 ? "No files" : "first was "+files[0], ! nrFiles, files.length); ! } finally { ! CompilerTestMethods.recursivelyDeleteDir(tempDir); ! } ! } ! ! }// ClassAndSourceOutputTests --- 1,65 ---- ! package net.sf.pizzacompiler; ! ! /** ! * $Id$ ! * ! * Copyright (C) 2001 Nicolas Fortescue. ! * This software is distributed under the Artistic License. See ! * artistic.html or artistic.txt which came with this distribution. ! * ! * Created: Thu Sep 13 15:36:05 2001 ! */ ! ! import junit.framework.*; ! import java.io.File; ! import java.io.IOException; ! ! public class ClassAndSourceOutputTests extends TestCase { ! public ClassAndSourceOutputTests(String s) { ! super(s); ! } ! ! final String GOOD_FILE = "APizzaClassTestCode.java"; ! final String WARNING_FILE = "UnreachableCodeTestCode.java"; ! final String BAD_FILE = "UnreachableCodeTestCode.java"; ! ! public void testClassesGetWrittenIfWarningOccurs() throws IOException { ! testNFilesGetWritten(WARNING_FILE, new String[0], 1); ! } ! public void testClassesDontGetWrittenIfErrorOccurs() throws IOException { ! testNFilesGetWritten(BAD_FILE, new String[0], 1); ! } ! ! public void testClassesWrittenToChosenDir() throws IOException { ! testNFilesGetWritten(GOOD_FILE, new String[0], 1); ! } ! ! public void testSourceWrittenToChosenDir() throws IOException { ! testNFilesGetWritten(GOOD_FILE, new String[]{"-s"}, 1); ! } ! ! private void testNFilesGetWritten(String filename, String [] args, ! int nrFiles) ! throws IOException { ! ! File tempDir = CompilerTestMethods.makeTempDirectory(); ! try { ! assertEquals(0, tempDir.listFiles().length); ! File source = ! CompilerTestMethods.findTestFile(this, filename); ! final String [] myArgs = ! new String[]{"-pizza", "-d", tempDir.getAbsolutePath()}; ! String [] allArgs = new String[args.length+myArgs.length]; ! System.arraycopy(args, 0, allArgs, 0, args.length); ! System.arraycopy(myArgs, 0, allArgs, args.length, myArgs.length); ! CompilerTestMethods.compilerOutput(source, allArgs); ! ! File [] files = tempDir.listFiles(); ! assertEquals(files.length == 0 ? "No files" : "first was "+files[0], ! nrFiles, files.length); ! } finally { ! CompilerTestMethods.recursivelyDeleteDir(tempDir); ! } ! } ! ! }// ClassAndSourceOutputTests |
From: Nick F. <nfo...@us...> - 2004-08-09 09:56:18
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30165/main/src/net/sf/pizzacompiler/compiler Modified Files: Type.pizza Log Message: fixed defect 788732, arrays now implements Serializable, Cloneable Index: Type.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/Type.pizza,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Type.pizza 8 Mar 2002 19:47:04 -0000 1.4 --- Type.pizza 9 Aug 2004 09:56:06 -0000 1.5 *************** *** 19,25 **** public class Type implements /*imports*/ Constants { ! static final boolean debugTypes = false;//DEBUG ! private TypeSymbol tsym; // the defining class /** --- 19,25 ---- public class Type implements /*imports*/ Constants { [...3109 lines suppressed...] ! completeBaseType(charType, "char", "net.sf.pizzacompiler.lang.Character"); ! completeBaseType(intType, "int", "java.lang.Integer"); ! completeBaseType(longType, "long", "java.lang.Long"); ! completeBaseType(floatType, "float", "java.lang.Float"); ! completeBaseType(doubleType, "double", "java.lang.Double"); ! completeBaseType(booleanType, "boolean", "java.lang.Boolean"); ! completeBaseType(voidType, "void", "java.lang.Void"); ! completeType(arrayType, "Array"); ! completeType(funType, "Function"); ! completeType(ErrType, "<any>"); ! completeType(AnyType, "<anything>"); ! ClassSymbol errClass = (ClassSymbol) ErrType.tsym; ! errClass.locals_j = errClass.locals_p = Scope.errScope; ! Scope.errScope.owner = ErrType.tsym; ! stringType = ! Symtab.reader.enterClass(Name.fromString("java.lang.String")).type; ! Symbol.errSymbol.type = ErrType; ! } } |
From: Nick F. <nfo...@us...> - 2004-08-09 09:56:17
|
Update of /cvsroot/pizzacompiler/pizza/bootstrap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30165/bootstrap Modified Files: pizza_ant.jar Log Message: fixed defect 788732, arrays now implements Serializable, Cloneable Index: pizza_ant.jar =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/bootstrap/pizza_ant.jar,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsa9Tpqf and /tmp/cvsaK7EpQ differ |
From: Nick F. <nfo...@us...> - 2004-08-09 07:59:00
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/ant In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11935/main/src/net/sf/pizzacompiler/ant Modified Files: Pizzac.java Log Message: updated so compiles with latest ant Index: Pizzac.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/ant/Pizzac.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Pizzac.java 29 Aug 2001 15:35:39 -0000 1.1.1.1 --- Pizzac.java 9 Aug 2004 07:58:51 -0000 1.2 *************** *** 1,75 **** ! package net.sf.pizzacompiler.ant; ! ! /** ! * $Id$ ! * ! * Copyright (C) 2001 Nicolas Fortescue ! * This software is distributed under the Artistic License. See ! * artistic.html or artistic.txt which came with this distribution. ! * ! * Created: Wed Aug 29 10:14:56 2001 ! */ ! ! import org.apache.tools.ant.BuildException; ! import org.apache.tools.ant.taskdefs.Javac; ! import org.apache.tools.ant.util.GlobPatternMapper; ! import org.apache.tools.ant.util.SourceFileScanner; ! import java.io.File; ! ! public class Pizzac extends Javac { ! private static final String COMPILER_PROPERTY = "build.compiler"; ! ! public Pizzac (){ ! ! } ! ! /** ! * for now we know to use the pizza compiler ! */ ! public void execute() throws BuildException { ! String oldCompiler = project.getProperty(COMPILER_PROPERTY); ! project.setProperty(COMPILER_PROPERTY, ! "net.sf.pizzacompiler.ant.PizzaCompiler"); ! super.execute(); ! resolveCompiler(oldCompiler); ! } ! ! protected void resolveCompiler(String oldCompiler) { ! if (oldCompiler == null) { ! if (project.getJavaVersion().startsWith("1.3")) { ! setCompiler("modern"); ! } else { ! setCompiler("classic"); ! } ! } else { ! setCompiler(oldCompiler); ! } ! } ! ! private void setCompiler(String compiler) { ! project.setProperty(COMPILER_PROPERTY, compiler); ! } ! ! /** ! * look for pizza files, then use javac task to look for .java files ! */ ! protected void scanDir(File srcDir, File destDir, String files[]) { ! super.scanDir(srcDir, destDir, files); ! GlobPatternMapper m = new GlobPatternMapper(); ! m.setFrom("*.pizza"); ! m.setTo("*.class"); ! SourceFileScanner sfs = new SourceFileScanner(this); ! File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m); ! ! if (newFiles.length > 0) { ! File[] newCompileList = new File[compileList.length + ! newFiles.length]; ! System.arraycopy(compileList, 0, newCompileList, 0, ! compileList.length); ! System.arraycopy(newFiles, 0, newCompileList, ! compileList.length, newFiles.length); ! compileList = newCompileList; ! } ! } ! ! }// Pizzac --- 1,76 ---- ! package net.sf.pizzacompiler.ant; ! ! /** ! * $Id$ ! * ! * Copyright (C) 2001 Nicolas Fortescue ! * This software is distributed under the Artistic License. See ! * artistic.html or artistic.txt which came with this distribution. ! * ! * Created: Wed Aug 29 10:14:56 2001 ! */ ! ! import org.apache.tools.ant.BuildException; ! import org.apache.tools.ant.taskdefs.Javac; ! import org.apache.tools.ant.util.GlobPatternMapper; ! import org.apache.tools.ant.util.SourceFileScanner; ! import org.apache.tools.ant.util.JavaEnvUtils; ! ! import java.io.File; ! ! public class Pizzac extends Javac { ! private static final String COMPILER_PROPERTY = "build.compiler"; ! ! public Pizzac (){ ! ! } ! ! /** ! * for now we know to use the pizza compiler ! */ ! public void execute() throws BuildException { ! String oldCompiler = getProject().getProperty(COMPILER_PROPERTY); ! getProject().setProperty(COMPILER_PROPERTY, "net.sf.pizzacompiler.ant.PizzaCompiler"); ! super.execute(); ! resolveCompiler(oldCompiler); ! } ! ! protected void resolveCompiler(String oldCompiler) { ! if (oldCompiler == null) { ! if (JavaEnvUtils.getJavaVersion().startsWith("1.3")) { ! setCompilerProperty("modern"); ! } else { ! setCompilerProperty("classic"); ! } ! } else { ! setCompilerProperty(oldCompiler); ! } ! } ! ! private void setCompilerProperty(String compiler) { ! getProject().setProperty(COMPILER_PROPERTY, compiler); ! } ! ! /** ! * look for pizza files, then use javac task to look for .java files ! */ ! protected void scanDir(File srcDir, File destDir, String files[]) { ! super.scanDir(srcDir, destDir, files); ! GlobPatternMapper m = new GlobPatternMapper(); ! m.setFrom("*.pizza"); ! m.setTo("*.class"); ! SourceFileScanner sfs = new SourceFileScanner(this); ! File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m); ! ! if (newFiles.length > 0) { ! File[] newCompileList = new File[compileList.length + ! newFiles.length]; ! System.arraycopy(compileList, 0, newCompileList, 0, ! compileList.length); ! System.arraycopy(newFiles, 0, newCompileList, ! compileList.length, newFiles.length); ! compileList = newCompileList; ! } ! } ! ! }// Pizzac |
From: Nick F. <nfo...@us...> - 2002-12-09 11:54:41
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/pizzadoc In directory sc8-pr-cvs1:/tmp/cvs-serv21933/main/src/net/sf/pizzacompiler/pizzadoc Modified Files: DocComment.pizza Log Message: incorporated multibyte code written by Mahesh Pendyala and Shigeaki Harada Index: DocComment.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/pizzadoc/DocComment.pizza,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DocComment.pizza 29 Aug 2001 15:35:51 -0000 1.1.1.1 --- DocComment.pizza 9 Dec 2002 11:54:37 -0000 1.2 *************** *** 33,40 **** { // Scanner constants ! final static byte LF = 0xA; ! final static byte FF = 0xC; ! final static byte CR = 0xD; ! final static byte SUB = 0x1A; /** --- 33,40 ---- { // Scanner constants ! final static char LF = 0xA; ! final static char FF = 0xC; ! final static char CR = 0xD; ! final static char SUB = 0x1A; /** *************** *** 125,129 **** * @param len length of region to read */ ! DocComment(int pos, byte[] buf, int offset, int len) { this.pos = pos; param = new Vector(allocPair, null); --- 125,129 ---- * @param len length of region to read */ ! DocComment(int pos, char[] buf, int offset, int len) { this.pos = pos; param = new Vector(allocPair, null); *************** *** 143,151 **** /** Scans the buffer. */ ! private void scan(byte[] buf, int offset, int len) { int bp = offset+1; /* the current character: */ ! byte ch = buf[bp]; int tagID = NoTag; boolean linestart = true; --- 143,151 ---- /** Scans the buffer. */ ! private void scan(char[] buf, int offset, int len) { int bp = offset+1; /* the current character: */ ! char ch = buf[bp]; int tagID = NoTag; boolean linestart = true; *************** *** 475,479 **** * @return true if a @deprecated flag is found */ ! public static boolean comment(int pos, byte[] buf, int offset, int len) { DocComment c = new DocComment(pos, buf, offset, len); --- 475,479 ---- * @return true if a @deprecated flag is found */ ! public static boolean comment(int pos, char[] buf, int offset, int len) { DocComment c = new DocComment(pos, buf, offset, len); |
From: Nick F. <nfo...@us...> - 2002-12-09 11:54:41
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv21933/main/src/net/sf/pizzacompiler/compiler Modified Files: Main.pizza Name.pizza Scanner.pizza Log Message: incorporated multibyte code written by Mahesh Pendyala and Shigeaki Harada Index: Main.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/Main.pizza,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Main.pizza 14 Feb 2002 18:04:44 -0000 1.17 --- Main.pizza 9 Dec 2002 11:54:37 -0000 1.18 *************** *** 22,29 **** /** ! * The main Pizza Compiler class.<p> */ public class Main implements /*imports*/ Constants { private static CompilerOutput s_output; private static String s_userClassPath = null; --- 22,37 ---- /** ! * The main Pizza Compiler class. ! * <p> ! * Copyright (C) 1996,97 Martin Odersky. All rights reserved. ! * Permission is hereby granted to modify and use this software for research ! * and teaching purposes. Modification for commercial purposes requires ! * prior written permission by the author. ! * The software, or modifications thereof, may be redistributed only ! * if this copyright notice stays attached. */ public class Main implements /*imports*/ Constants { + private static String encoding; private static CompilerOutput s_output; private static String s_userClassPath = null; *************** *** 106,109 **** --- 114,121 ---- } + public static void setEncoding(String charSet) { + encoding = charSet; + } + /** * Sets the output directory. *************** *** 145,148 **** --- 157,164 ---- i++; argv[i] = null; + } else if (arg.equals("-encoding") && i+1 < argv.length) { + setEncoding(argv[i+1]); + i++; + argv[i] = null; } else if (arg.equals("-version")) { System.out.println( *************** *** 174,178 **** } Name prev = Report.useSource(Name.fromString(filename)); ! Scanner scanner = new Scanner(infile); Parser parser = new Parser(scanner); defs = parser.compilationUnit(); --- 190,194 ---- } Name prev = Report.useSource(Name.fromString(filename)); ! Scanner scanner = new Scanner(infile, encoding); Parser parser = new Parser(scanner); defs = parser.compilationUnit(); *************** *** 270,273 **** --- 286,290 ---- */ public static void init() { + setEncoding(null); setDestinationDir(null); Switches.resetToDefaults(); Index: Name.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/Name.pizza,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Name.pizza 29 Aug 2001 15:35:45 -0000 1.1.1.1 --- Name.pizza 9 Dec 2002 11:54:37 -0000 1.2 *************** *** 13,17 **** class Convert { ! public static int digit2int(byte ch, int base) { if ('0' <= ch && ch <= '9' && ch < '0' + base) return ch - '0'; --- 13,17 ---- class Convert { ! public static int digit2int(char ch, int base) { if ('0' <= ch && ch <= '9' && ch < '0' + base) return ch - '0'; *************** *** 24,30 **** } ! public static byte int2digit(int x) { ! if (x <= 9) return (byte)(x + '0'); ! else return (byte)(x - 10 + 'A'); } --- 24,30 ---- } ! private static char int2digit(int x) { ! if (x <= 9) return (char)(x + '0'); ! else return (char)(x - 10 + 'A'); } *************** *** 40,44 **** /** convert source bytes in source[offset..offset+len-1] to ascii. */ ! public static int source2ascii(byte source[], int offset, int len, byte ascii[]) { int j = 0; --- 40,44 ---- /** convert source bytes in source[offset..offset+len-1] to ascii. */ ! public static int source2ascii(char source[], int offset, int len, byte ascii[]) { int j = 0; *************** *** 86,96 **** } } ! byte b = source[offset + i++]; ! if (b >= 0) ! ascii[j++] = b; ! else { ! ascii[j++] = (byte)(0xC0 | ((b >> 6) & 0x3)); ! ascii[j++] = (byte)(0x80 | (b & 0x3F)); ! } } return j; --- 86,101 ---- } } ! int b = source[offset + i++]; ! if (b <= 0x7F) { ! ascii[j++] = (byte)b; ! } else if (b <= 0x3FF) { ! ascii[j++] = (byte)(0xC0 | (b >> 6)); ! ascii[j++] = (byte)(0x80 | (b & 0x3F)); ! } else { ! ascii[j++] = (byte)(0xE0 | (b >> 12)); ! ascii[j++] = (byte)(0x80 | ! ((b >> 6) & 0x3F)); ! ascii[j++] = (byte)(0x80 | (b & 0x3F)); ! } } return j; *************** *** 100,103 **** --- 105,109 ---- */ public static String ascii2string(byte ascii[], int offset, int len) { + char cs[] = new char[len]; int i = 0; *************** *** 120,125 **** /** convert string to array of source bytes. */ ! public static byte[] string2source(String s) { ! byte[] source = new byte[s.length() * 6]; int j = 0; for (int i = 0; i < s.length(); i++) { --- 126,131 ---- /** convert string to array of source bytes. */ ! public static char[] string2source(String s) { ! char[] source = new char[s.length() * 6]; int j = 0; for (int i = 0; i < s.length(); i++) { *************** *** 160,164 **** default: if (' ' <= ch && ch <= 127) ! source[j++] = (byte)ch; else { source[j++] = '\\'; --- 166,170 ---- default: if (' ' <= ch && ch <= 127) ! source[j++] = (char)ch; else { source[j++] = '\\'; *************** *** 171,175 **** } } ! byte[] res = new byte[j]; System.arraycopy(source, 0, res, 0, j); return res; --- 177,181 ---- } } ! char[] res = new char[j]; System.arraycopy(source, 0, res, 0, j); return res; *************** *** 179,184 **** */ public static byte[] string2ascii(String s) { ! byte[] source = string2source(s); ! byte[] ascii = new byte[source.length * 2]; int alen = source2ascii(source, 0, source.length, ascii); byte[] res = new byte[alen]; --- 185,190 ---- */ public static byte[] string2ascii(String s) { ! char[] source = string2source(s); ! byte[] ascii = new byte[source.length * 3]; int alen = source2ascii(source, 0, source.length, ascii); byte[] res = new byte[alen]; *************** *** 190,194 **** */ public static String escape(String s) { ! return new String(string2source(s), 0); } --- 196,200 ---- */ public static String escape(String s) { ! return new String(string2source(s)); } *************** *** 276,281 **** * assume that characters are in source format. */ ! public static Name fromSource(byte cs[], int offset, int len) { ! byte[] ascii = new byte[len * 2]; int alen = Convert.source2ascii(cs, offset, len, ascii); return fromAscii(ascii, 0, alen); --- 282,287 ---- * assume that characters are in source format. */ ! public static Name fromSource(char cs[], int offset, int len) { ! byte[] ascii = new byte[len * 3]; int alen = Convert.source2ascii(cs, offset, len, ascii); return fromAscii(ascii, 0, alen); *************** *** 286,290 **** */ public static Name fromString(String s) { ! byte[] source = Convert.string2source(s); return fromSource(source, 0, source.length); } --- 292,296 ---- */ public static Name fromString(String s) { ! char[] source = Convert.string2source(s); return fromSource(source, 0, source.length); } *************** *** 309,313 **** * Return the source representation of this name. */ ! public byte[] toSource() { return Convert.string2source(toString()); } --- 315,319 ---- * Return the source representation of this name. */ ! public char[] toSource() { return Convert.string2source(toString()); } Index: Scanner.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/Scanner.pizza,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Scanner.pizza 6 Dec 2001 11:46:37 -0000 1.3 --- Scanner.pizza 9 Dec 2002 11:54:37 -0000 1.4 *************** *** 17,24 **** */ final static int tabinc = 8; ! final static byte LF = 0xA; ! final static byte FF = 0xC; ! final static byte CR = 0xD; ! final static byte SUB = 0x1A; /** Keyword array. Maps from name indices to Tokens. --- 17,24 ---- */ final static int tabinc = 8; ! final static char LF = 0xA; ! final static char FF = 0xC; ! final static char CR = 0xD; ! final static char SUB = 0x1A; /** Keyword array. Maps from name indices to Tokens. *************** *** 67,76 **** /** The input buffer: */ ! private byte[] buf; private int bp; /** the current character: */ ! private byte ch; /** the line and column position of the current character --- 67,76 ---- /** The input buffer: */ ! private char[] buf; private int bp; /** the current character: */ ! private char ch; /** the line and column position of the current character *************** *** 81,85 **** /** a buffer for character and string literals: */ ! private byte[] lit = new byte[64]; private int litlen; --- 81,85 ---- /** a buffer for character and string literals: */ ! private char[] lit = new char[64]; private int litlen; *************** *** 91,105 **** /** Construct a scanner from a file input stream. */ ! Scanner(InputStream in) { try { ! buf = new byte[in.available() + 1]; ! if (in.read(buf) != buf.length - 1) throw new IOException("read error"); } catch (IOException e) { lexError(e.toString()); ! buf = new byte[1]; } if (buf.length == 0 || buf[buf.length - 1] > ' ') { ! byte[] newbuf = new byte[buf.length + 1]; System.arraycopy(buf, 0, newbuf, 0, buf.length); buf = newbuf; --- 91,117 ---- /** Construct a scanner from a file input stream. */ ! Scanner(InputStream in, String encoding) { ! try { ! byte[] bytebuf = new byte[in.available()]; ! if (in.read(bytebuf) != bytebuf.length) throw new IOException("read error"); + String program; + if (encoding == null) + program = new String(bytebuf); + else + program = new String(bytebuf, encoding); + bytebuf = null; + int len = program.length(); + this.buf = new char[len + 1]; + program.getChars(0, len, this.buf, 0); + program = null; + buf[len] = SUB; } catch (IOException e) { lexError(e.toString()); ! buf = new char[1]; } if (buf.length == 0 || buf[buf.length - 1] > ' ') { ! char[] newbuf = new char[buf.length + 1]; System.arraycopy(buf, 0, newbuf, 0, buf.length); buf = newbuf; *************** *** 118,122 **** */ private void dch() { ! System.out.print((char)ch); System.out.flush(); } --- 130,135 ---- */ private void dch() { ! System.out.print("char at position " + bp + " is >>" + (char)ch + "<<"); ! System.out.flush(); } *************** *** 124,127 **** --- 137,141 ---- */ private void lexError(String msg, int pos) { + new Exception(msg).printStackTrace(); Report.error(pos, msg); token = NoTk; *************** *** 137,143 **** /** Append characteter to "lit" buffer: */ ! private void putch(byte c) { if (litlen == lit.length) { ! byte[] newlit = new byte[lit.length * 2]; System.arraycopy(lit, 0, newlit, 0, lit.length); lit = newlit; --- 151,157 ---- /** Append characteter to "lit" buffer: */ ! private void putch(char c) { if (litlen == lit.length) { ! char[] newlit = new char[lit.length * 2]; System.arraycopy(lit, 0, newlit, 0, lit.length); lit = newlit; *************** *** 146,149 **** --- 160,179 ---- } + /** scan next 6 characters (\uxxxx) as unicode: + */ + private void scanUnicode() { + if (!isUnicode()) { + ch = buf[++bp]; ccol++; + lexError("illegal character"); + return; + } else { + ch = buf[++bp]; ccol++; + ch = buf[++bp]; ccol++; + ch = buf[++bp]; ccol++; + ch = buf[++bp]; ccol++; + ch = buf[++bp]; ccol++; + } + } + /** return true iff next 6 characters are a valid unicode sequence: */ *************** *** 173,177 **** ch = buf[++bp]; ccol++; if ('0' <= ch && ch <= '7') { ! byte leadch = ch; int oct = Convert.digit2int(ch, 8); ch = buf[++bp]; ccol++; --- 203,207 ---- ch = buf[++bp]; ccol++; if ('0' <= ch && ch <= '7') { ! char leadch = ch; int oct = Convert.digit2int(ch, 8); ch = buf[++bp]; ccol++; *************** *** 184,193 **** } } ! putch((byte)oct); } else if (ch != SUB) { switch (ch) { case 'b': case 't': case 'n': case 'f': case 'r': case '\"': case '\'': case '\\': ! putch((byte)'\\'); putch(ch); break; --- 214,223 ---- } } ! putch((char)oct); } else if (ch != SUB) { switch (ch) { case 'b': case 't': case 'n': case 'f': case 'r': case '\"': case '\'': case '\\': ! putch((char)'\\'); putch(ch); break; *************** *** 217,221 **** ch = buf[++bp]; ccol++; if (ch == '+' || ch == '-') { ! byte sign = ch; ch = buf[++bp]; ccol++; if (!('0' <= ch && ch <= '9')) { --- 247,251 ---- ch = buf[++bp]; ccol++; if (ch == '+' || ch == '-') { ! char sign = ch; ch = buf[++bp]; ccol++; if (!('0' <= ch && ch <= '9')) { *************** *** 238,242 **** try { floatVal = ! Double.valueOf(new String(buf, 0, index, bp - index)) .doubleValue(); if (floatVal > limit) --- 268,272 ---- try { floatVal = ! Double.valueOf(new String(buf, index, bp - index)) .doubleValue(); if (floatVal > limit) *************** *** 302,306 **** /** return true if ch can be part of an operator: */ ! private boolean isspecial(byte ch) { switch(ch) { case '!': case '%': case '&': case '*': case '?': --- 332,336 ---- /** return true if ch can be part of an operator: */ ! private boolean isspecial(char ch) { switch(ch) { case '!': case '%': case '&': case '*': case '?': *************** *** 318,327 **** private void getspecials() { int index = bp; ! name = Name.fromAscii(buf, index, 1); while (true) { token = key[name.index]; ch = buf[++bp]; ccol++; if (!isspecial(ch)) break; ! Name newname = Name.fromAscii(buf, index, bp + 1 - index); if (newname.index > maxKey || key[newname.index] == Id) break; name = newname; --- 348,357 ---- private void getspecials() { int index = bp; ! name = Name.fromSource(buf, index, 1); while (true) { token = key[name.index]; ch = buf[++bp]; ccol++; if (!isspecial(ch)) break; ! Name newname = Name.fromSource(buf, index, bp + 1 - index); if (newname.index > maxKey || key[newname.index] == Id) break; name = newname; *************** *** 333,341 **** * a @deprecated tag. */ ! static boolean scan4deprecated(byte[] buf, int offset, int len) { int bp = offset+1; /* the current character: */ ! byte ch = buf[bp]; boolean linestart = true; while (bp < offset + len - 1 && --- 363,371 ---- * a @deprecated tag. */ ! static boolean scan4deprecated(char[] buf, int offset, int len) { int bp = offset+1; /* the current character: */ ! char ch = buf[bp]; boolean linestart = true; while (bp < offset + len - 1 && *************** *** 434,511 **** ch = buf[++bp]; ccol++; break; ! case '\\': ! if (!isUnicode()) { ! ch = buf[++bp]; ccol++; ! lexError("illegal character"); ! return; ! } else { ! escaped = true; ! ch = buf[++bp]; ccol++; ! ch = buf[++bp]; ccol++; ! ch = buf[++bp]; ccol++; ! ch = buf[++bp]; ccol++; ! ch = buf[++bp]; ccol++; ! ch = 'A'; ! // fall-through intentional ! } ! case 'A': case 'B': case 'C': case 'D': case 'E': ! case 'F': case 'G': case 'H': case 'I': case 'J': ! case 'K': case 'L': case 'M': case 'N': case 'O': ! case 'P': case 'Q': case 'R': case 'S': case 'T': ! case 'U': case 'V': case 'W': case 'X': case 'Y': ! case 'Z': ! case 'a': case 'b': case 'c': case 'd': case 'e': ! case 'f': case 'g': case 'h': case 'i': case 'j': ! case 'k': case 'l': case 'm': case 'n': case 'o': ! case 'p': case 'q': case 'r': case 's': case 't': ! case 'u': case 'v': case 'w': case 'x': case 'y': ! case 'z': ! case '$': case '_': ! while (true) { ! ch = buf[++bp]; ccol++; ! switch (ch) { ! case 'A': case 'B': case 'C': case 'D': case 'E': ! case 'F': case 'G': case 'H': case 'I': case 'J': ! case 'K': case 'L': case 'M': case 'N': case 'O': ! case 'P': case 'Q': case 'R': case 'S': case 'T': ! case 'U': case 'V': case 'W': case 'X': case 'Y': ! case 'Z': ! case 'a': case 'b': case 'c': case 'd': case 'e': ! case 'f': case 'g': case 'h': case 'i': case 'j': ! case 'k': case 'l': case 'm': case 'n': case 'o': ! case 'p': case 'q': case 'r': case 's': case 't': ! case 'u': case 'v': case 'w': case 'x': case 'y': ! case 'z': ! case '$': case '_': ! case '0': case '1': case '2': case '3': case '4': ! case '5': case '6': case '7': case '8': case '9': ! break; ! case '\\': ! if (!isUnicode()) { ! ch = buf[++bp]; ccol++; ! lexError("illegal character"); ! return; ! } else { ! escaped = true; ! ch = buf[++bp]; ccol++; ! ch = buf[++bp]; ccol++; ! ch = buf[++bp]; ccol++; ! ch = buf[++bp]; ccol++; ! ch = buf[++bp]; ccol++; ! break; ! } ! default: ! if (ch < 0) break; ! if (escaped) ! name = Name.fromSource(buf, index, bp - index); ! else ! name = Name.fromAscii(buf, index, bp - index); ! if (name.index <= maxKey) ! token = key[name.index]; ! else ! token = Id; ! return; ! } ! } case '0': ch = buf[++bp]; ccol++; --- 464,468 ---- ch = buf[++bp]; ccol++; break; ! case '0': ch = buf[++bp]; ccol++; *************** *** 647,650 **** --- 604,630 ---- if (isspecial(ch)) getspecials(); + else if (ch == '\\' || (Character.isJavaIdentifierStart(ch))) { + int start = bp; + if (ch == '\\') { + scanUnicode(); + } + + while (true) { + ch = buf[++bp]; ccol++; + switch (ch) { + case '\\': + scanUnicode(); + default: + if (!Character.isJavaIdentifierPart(ch)) { + name = Name.fromSource(buf, start, bp - start); + if (name.index <= maxKey) + token = key[name.index]; + else + token = Id; + return; + } + } + } + } else { ch = buf[++bp]; ccol++; *************** *** 797,810 **** if (tokenName[j] != null) key[tokenName[j].index] = j; } - } - - - - - - - - - - --- 777,780 ---- if (tokenName[j] != null) key[tokenName[j].index] = j; } + } |
From: Enno R. <enn...@us...> - 2002-10-25 02:19:50
|
Update of /cvsroot/pizzacompiler/pizzasite/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv19285 Modified Files: index.html Log Message: corrected GJ link Index: index.html =================================================================== RCS file: /cvsroot/pizzacompiler/pizzasite/htdocs/index.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.html 9 Jan 2002 13:30:04 -0000 1.2 --- index.html 24 Oct 2002 16:00:38 -0000 1.3 *************** *** 116,120 **** <td align=right valign=top> <font face="Arial,Helvetica"> ! <a href="http://www.research.avayalabs.com/user/wadler/pizza/gj/"><strong>Generic Java (GJ)</strong><br></a> <td bgcolor="#60CB8E" width=5> </td> --- 116,120 ---- <td align=right valign=top> <font face="Arial,Helvetica"> ! <a href="http://www.research.avayalabs.com/user/wadler/gj/"><strong>Generic Java (GJ)</strong><br></a> <td bgcolor="#60CB8E" width=5> </td> |
From: Enno R. <enn...@us...> - 2002-09-10 11:31:38
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv827/main/src/net/sf/pizzacompiler/compiler Modified Files: Enter.pizza Log Message: re-allow fields in inner classes (bug 606778) fix by jwclaypool Index: Enter.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/Enter.pizza,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Enter.pizza 25 Jul 2002 08:30:58 -0000 1.5 --- Enter.pizza 10 Sep 2002 11:31:35 -0000 1.6 *************** *** 667,680 **** break; } if (c.owner.kind != PCK && (c.modifiers & INTERFACE) == 0 && (mods & STATIC) == 0) { if (defs[i] instanceof VarDef) { ! if ((defs[i].mods() & (STATIC | FINAL)) != (STATIC | FINAL)) { Report.error(defs[i].pos, "inner classes cannot have non-final static variables"); } } else { ! if ((defs[i].mods() & STATIC) != 0) { Report.error(defs[i].pos, "inner classes cannot have static declarations"); --- 667,682 ---- break; } + int defmods = defs[i].mods(); if (c.owner.kind != PCK && (c.modifiers & INTERFACE) == 0 && (mods & STATIC) == 0) { if (defs[i] instanceof VarDef) { ! if ((defmods & STATIC) != 0 && ! (defmods & FINAL) == 0 ) { Report.error(defs[i].pos, "inner classes cannot have non-final static variables"); } } else { ! if ((defmods & STATIC) != 0) { Report.error(defs[i].pos, "inner classes cannot have static declarations"); |
From: Enno R. <enn...@us...> - 2002-09-10 11:31:37
|
Update of /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv827/tests/src/unit/net/sf/pizzacompiler/compiler Modified Files: InnerClassStaticVarTest.pizza Log Message: re-allow fields in inner classes (bug 606778) fix by jwclaypool Index: InnerClassStaticVarTest.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler/InnerClassStaticVarTest.pizza,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InnerClassStaticVarTest.pizza 25 Jul 2002 08:30:58 -0000 1.1 --- InnerClassStaticVarTest.pizza 10 Sep 2002 11:31:34 -0000 1.2 *************** *** 21,24 **** --- 21,25 ---- " public class ExampleInner {\n"+ " public static final int id = 5;\n"+ + " public int var;\n"+ " }\n"+ "}"; |
From: Enno R. <enn...@us...> - 2002-07-29 13:00:15
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/pizzadoc In directory usw-pr-cvs1:/tmp/cvs-serv20523/main/src/net/sf/pizzacompiler/pizzadoc Modified Files: DocAST.pizza Log Message: added null check for packages in collectInfo (bug 586993) Index: DocAST.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/pizzadoc/DocAST.pizza,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DocAST.pizza 29 Aug 2001 15:35:51 -0000 1.1.1.1 --- DocAST.pizza 29 Jul 2002 13:00:10 -0000 1.2 *************** *** 168,172 **** case TopLevel(Name sourcefile, AST[] defs, PackageSymbol packge, _, _): ! if (actPackage != packge) { // following classes belong to another package packageFile = inProcess.get(packge); // package handled before? if (packageFile == null) { --- 168,172 ---- case TopLevel(Name sourcefile, AST[] defs, PackageSymbol packge, _, _): ! if (actPackage != packge && packge != null) { // following classes belong to another package packageFile = inProcess.get(packge); // package handled before? if (packageFile == null) { |
From: Enno R. <enn...@us...> - 2002-07-25 08:31:03
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv17775/main/src/net/sf/pizzacompiler/compiler Modified Files: Enter.pizza Log Message: Made Pizza allow final static variables in inner classes. I hope that doesn't crash other parts in Pizza's buggy inner classes translation. Index: Enter.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/Enter.pizza,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Enter.pizza 6 Dec 2001 11:46:37 -0000 1.4 --- Enter.pizza 25 Jul 2002 08:30:58 -0000 1.5 *************** *** 669,676 **** if (c.owner.kind != PCK && (c.modifiers & INTERFACE) == 0 && ! (mods & STATIC) == 0 && ! (defs[i].mods() & STATIC) != 0) { ! Report.error(defs[i].pos, ! "inner classes cannot have static members"); } } --- 669,684 ---- if (c.owner.kind != PCK && (c.modifiers & INTERFACE) == 0 && ! (mods & STATIC) == 0) { ! if (defs[i] instanceof VarDef) { ! if ((defs[i].mods() & (STATIC | FINAL)) != (STATIC | FINAL)) { ! Report.error(defs[i].pos, ! "inner classes cannot have non-final static variables"); ! } ! } else { ! if ((defs[i].mods() & STATIC) != 0) { ! Report.error(defs[i].pos, ! "inner classes cannot have static declarations"); ! } ! } } } |
From: Enno R. <enn...@us...> - 2002-07-25 08:31:02
|
Update of /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv17775/tests/src/unit/net/sf/pizzacompiler/compiler Modified Files: AllUnitTests.java Added Files: InnerClassStaticVarTest.pizza Log Message: Made Pizza allow final static variables in inner classes. I hope that doesn't crash other parts in Pizza's buggy inner classes translation. --- NEW FILE: InnerClassStaticVarTest.pizza --- package net.sf.pizzacompiler.compiler; /** * $Id: InnerClassStaticVarTest.pizza,v 1.1 2002/07/25 08:30:58 ennorunne Exp $ * * Copyright (C) 2002 Enno Runne * This software is distributed under the Artistic License. See * artistic.html or artistic.txt which came with this distribution. */ import junit.framework.TestCase; import java.util.Collections; import java.io.PrintStream; import java.io.ByteArrayOutputStream; public class InnerClassStaticVarTest extends TestCase { private final String OK_CODE_1 = "public class Example { \n"+ " public class ExampleInner {\n"+ " public static final int id = 5;\n"+ " }\n"+ "}"; private final String BUG_CODE_1 = "public class Example { \n"+ " public class ExampleInner {\n"+ " public static int id = 5;\n"+ " }\n"+ "}"; private final String BUG_CODE_2 = "public class Example { \n"+ " public class ExampleInner {\n"+ " public static final void method() { }\n"+ " }\n"+ "}"; public InnerClassStaticVarTest(String s) { super(s); } private PrintStream errorOut; public void setUp() { errorOut = new PrintStream(new ByteArrayOutputStream()); } public void testOk() { final String CLASS_NAME = "Example.pizza"; MapSourceReader source = new MapSourceReader(Collections.singletonMap(CLASS_NAME, OK_CODE_1)); Main.init(); Main.compile(new String[]{CLASS_NAME}, source, new FileCompilerOutput(null), errorOut); assertTrue(Report.getErrorsAndWarnings().isEmpty()); } public void testNonFinal() { final String CLASS_NAME = "Example.pizza"; MapSourceReader source = new MapSourceReader(Collections.singletonMap(CLASS_NAME, BUG_CODE_1)); Main.init(); Main.compile(new String[]{CLASS_NAME}, source, new FileCompilerOutput(null), errorOut); assertEquals(1, Report.getErrorsAndWarnings().size()); } public void testFinalStaticMethod() { final String CLASS_NAME = "Example.pizza"; MapSourceReader source = new MapSourceReader(Collections.singletonMap(CLASS_NAME, BUG_CODE_2)); Main.init(); Main.compile(new String[]{CLASS_NAME}, source, new FileCompilerOutput(null), errorOut); assertEquals(1, Report.getErrorsAndWarnings().size()); } } Index: AllUnitTests.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler/AllUnitTests.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AllUnitTests.java 15 May 2002 20:42:34 -0000 1.6 --- AllUnitTests.java 25 Jul 2002 08:30:58 -0000 1.7 *************** *** 20,23 **** --- 20,24 ---- suite.addTest(new TestSuite(ErrorMessageTest.class)); suite.addTest(new TestSuite(FileCompilerOutputTest.class)); + suite.addTest(new TestSuite(InnerClassStaticVarTest.class)); suite.addTest(new TestSuite(MainTest.class)); suite.addTest(new TestSuite(MapSourceReaderTest.class)); |
From: Enno R. <enn...@us...> - 2002-07-25 07:17:31
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/pizzadoc In directory usw-pr-cvs1:/tmp/cvs-serv30965/main/src/net/sf/pizzacompiler/pizzadoc Modified Files: DocHTML.pizza Log Message: Put in some explaining alternate texts for ugly ball images Index: DocHTML.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/pizzadoc/DocHTML.pizza,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DocHTML.pizza 4 Sep 2001 16:46:16 -0000 1.2 --- DocHTML.pizza 25 Jul 2002 07:17:28 -0000 1.3 *************** *** 3,7 **** * by Enno Runne * ! * Copyright (C) 1997 Enno Runne. * This software is distributed under the Artistic License. See * artistic.html or artistic.txt which came with this distribution. --- 3,7 ---- * by Enno Runne * ! * Copyright (C) 1997, 2002 Enno Runne. * This software is distributed under the Artistic License. See * artistic.html or artistic.txt which came with this distribution. *************** *** 95,138 **** "<p><h2><img src=\"p-images/innerclasses.gif\" alt=\"Inner Classes\"></h2>"; static final String INNERCLASS_BULLET = ! "<img src=\"p-images/sq-blue.gif\" alt=\"O \"> "; static final String INNERCLASS_IMG_I = "<p><h2><img src=\"p-images/innerclass-index.gif\" alt=\"Inner Class Index\"></h2>"; static final String INNERCLASS_BULLET_I = ! "<img src=\"p-images/sql-blue.gif\" alt=\"O \"> "; static final String CONSTRUCTOR_IMG = "<p><h2><img src=\"p-images/constructors.gif\" alt=\"Constructors\"></h2>"; static final String CONSTRUCTOR_BULLET = ! "<img src=\"p-images/yellow-ball.gif\" alt=\"O \"> "; static final String CONSTRUCTOR_IMG_I = "<p><h2><img src=\"p-images/constructor-index.gif\" alt=\"Constuctor Index\"></h2>"; static final String CONSTRUCTOR_BULLET_I = ! "<img src=\"p-images/yellow-ball-small.gif\" alt=\"O \"> "; static final String VARIABLE_IMG = "<p><h2><img src=\"p-images/variables.gif\" alt=\"Variables\"></h2>"; static final String VARIABLE_BULLET = ! "<img src=\"p-images/magenta-ball.gif\" alt=\"O \"> "; static final String VARIABLE_BULLET_S = ! "<img src=\"p-images/blue-ball.gif\" alt=\"O \"> "; static final String VARIABLE_IMG_I = "<p><h2><img src=\"p-images/variable-index.gif\" alt=\"Variables Index\"></h2>"; static final String VARIABLE_BULLET_I = ! "<img src=\"p-images/magenta-ball-small.gif\" alt=\"O \"> "; static final String VARIABLE_BULLET_IS = ! "<img src=\"p-images/blue-ball-small.gif\" alt=\"O \"> "; static final String METHOD_IMG = "<p><h2><img src=\"p-images/methods.gif\" alt=\"Methods\"></h2>"; static final String METHOD_BULLET = ! "<img src=\"p-images/red-ball.gif\" alt=\"O \"> "; static final String METHOD_BULLET_S = ! "<img src=\"p-images/green-ball.gif\" alt=\"O \"> "; static final String METHOD_IMG_I = "<p><h2><img src=\"p-images/method-index.gif\" alt=\"Methods\"></h2>"; static final String METHOD_BULLET_I = ! "<img src=\"p-images/red-ball-small.gif\" alt=\"O \"> "; static final String METHOD_BULLET_IS = ! "<img src=\"p-images/green-ball-small.gif\" alt=\"O \"> "; //------------------------------ constants for links --- 95,138 ---- "<p><h2><img src=\"p-images/innerclasses.gif\" alt=\"Inner Classes\"></h2>"; static final String INNERCLASS_BULLET = ! "<img src=\"p-images/sq-blue.gif\" alt=\"inner class \"> "; static final String INNERCLASS_IMG_I = "<p><h2><img src=\"p-images/innerclass-index.gif\" alt=\"Inner Class Index\"></h2>"; static final String INNERCLASS_BULLET_I = ! "<img src=\"p-images/sql-blue.gif\" alt=\"inner class \"> "; static final String CONSTRUCTOR_IMG = "<p><h2><img src=\"p-images/constructors.gif\" alt=\"Constructors\"></h2>"; static final String CONSTRUCTOR_BULLET = ! "<img src=\"p-images/yellow-ball.gif\" alt=\"constructor \"> "; static final String CONSTRUCTOR_IMG_I = "<p><h2><img src=\"p-images/constructor-index.gif\" alt=\"Constuctor Index\"></h2>"; static final String CONSTRUCTOR_BULLET_I = ! "<img src=\"p-images/yellow-ball-small.gif\" alt=\"constructor \"> "; static final String VARIABLE_IMG = "<p><h2><img src=\"p-images/variables.gif\" alt=\"Variables\"></h2>"; static final String VARIABLE_BULLET = ! "<img src=\"p-images/magenta-ball.gif\" alt=\"member variable \"> "; static final String VARIABLE_BULLET_S = ! "<img src=\"p-images/blue-ball.gif\" alt=\"static variable \"> "; static final String VARIABLE_IMG_I = "<p><h2><img src=\"p-images/variable-index.gif\" alt=\"Variables Index\"></h2>"; static final String VARIABLE_BULLET_I = ! "<img src=\"p-images/magenta-ball-small.gif\" alt=\"member variable \"> "; static final String VARIABLE_BULLET_IS = ! "<img src=\"p-images/blue-ball-small.gif\" alt=\"static variable \"> "; static final String METHOD_IMG = "<p><h2><img src=\"p-images/methods.gif\" alt=\"Methods\"></h2>"; static final String METHOD_BULLET = ! "<img src=\"p-images/red-ball.gif\" alt=\"method \"> "; static final String METHOD_BULLET_S = ! "<img src=\"p-images/green-ball.gif\" alt=\"static method \"> "; static final String METHOD_IMG_I = "<p><h2><img src=\"p-images/method-index.gif\" alt=\"Methods\"></h2>"; static final String METHOD_BULLET_I = ! "<img src=\"p-images/red-ball-small.gif\" alt=\"method \"> "; static final String METHOD_BULLET_IS = ! "<img src=\"p-images/green-ball-small.gif\" alt=\"static method \"> "; //------------------------------ constants for links |
From: Enno R. <enn...@us...> - 2002-07-25 07:16:29
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/pizzadoc In directory usw-pr-cvs1:/tmp/cvs-serv30719/main/src/net/sf/pizzacompiler/pizzadoc Modified Files: DocType.pizza Log Message: Made Pizzadoc ignore unknown types in -nodebug mode Index: DocType.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/pizzadoc/DocType.pizza,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DocType.pizza 29 Aug 2001 15:35:53 -0000 1.1.1.1 --- DocType.pizza 25 Jul 2002 07:16:26 -0000 1.2 *************** *** 3,7 **** * by Enno Runne * ! * Copyright (C) 1997 Enno Runne. * This software is distributed under the Artistic License. See * artistic.html or artistic.txt which came with this distribution. --- 3,7 ---- * by Enno Runne * ! * Copyright (C) 1997, 2002 Enno Runne. * This software is distributed under the Artistic License. See * artistic.html or artistic.txt which came with this distribution. *************** *** 81,85 **** default: ! throw new DocException("default! "+t.tsym().name.toString()); } } --- 81,87 ---- default: ! if (DocSwitches.pizzadoc_debug) ! throw new DocException("default! "+t.tsym().name.toString()); ! return "!unknown typeID!"; } } |
From: Nick F. <nfo...@us...> - 2002-07-10 15:03:05
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv17388/main/src/net/sf/pizzacompiler/compiler Modified Files: ByteArrayClassLoader.java ByteArrayCompilerOutput.java ClassReader.pizza Log Message: fixed defect whereby Jars on the classpath were being kept open too long Index: ByteArrayClassLoader.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/ByteArrayClassLoader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ByteArrayClassLoader.java 19 Sep 2001 10:55:54 -0000 1.1 --- ByteArrayClassLoader.java 10 Jul 2002 15:03:01 -0000 1.2 *************** *** 12,15 **** --- 12,16 ---- import java.util.*; + import java.io.InputStream; /** *************** *** 21,25 **** public class ByteArrayClassLoader extends ClassLoader { private Map _namesToClasses; - public ByteArrayClassLoader(ClassLoader parentClassLoader, Collection bytecode) { --- 22,25 ---- *************** *** 32,36 **** } } ! public Class findClass( String name ) throws ClassNotFoundException { Class theClass = (Class)_namesToClasses.get(name); --- 32,36 ---- } } ! public Class findClass( String name ) throws ClassNotFoundException { Class theClass = (Class)_namesToClasses.get(name); *************** *** 41,43 **** --- 41,45 ---- } } + + }// ByteArrayClassLoader Index: ByteArrayCompilerOutput.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/ByteArrayCompilerOutput.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ByteArrayCompilerOutput.java 19 Sep 2001 10:55:54 -0000 1.1 --- ByteArrayCompilerOutput.java 10 Jul 2002 15:03:01 -0000 1.2 *************** *** 56,58 **** --- 56,68 ---- return code; } + + public Map getFilesToBytecode() { + HashMap result = new HashMap(); + for(Iterator i = _streams.entrySet().iterator(); i.hasNext();) { + Map.Entry entry = (Map.Entry)i.next(); + ByteArrayOutputStream baos = (ByteArrayOutputStream)entry.getValue(); + result.put(entry.getKey(), baos.toByteArray()); + } + return result; + } }// ByteArrayCompilerOutput Index: ClassReader.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/ClassReader.pizza,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ClassReader.pizza 6 Dec 2001 11:46:37 -0000 1.10 --- ClassReader.pizza 10 Jul 2002 15:03:01 -0000 1.11 *************** *** 1,1102 **** ! /* ************************************************************************ ! * Pizza classfile loading ! * by Martin Odersky ! * ! * Copyright (C) 1996-2001 Martin Odersky. ! * This software is distributed under the Artistic License. See ! * artistic.html or artistic.txt which came with this distribution. ! */ ! ! package net.sf.pizzacompiler.compiler; [...2187 lines suppressed...] ! return res; ! } ! ! protected String [] getFilesForPackage(String aClassPath, ! String packageDirectory) { ! ArrayList result = new ArrayList(); ! int i = 0; ! while (i < aClassPath.length()) { ! int end = aClassPath.indexOf(PATH_SEP, i); ! end = end == -1 ? aClassPath.length() : end; ! String pathname = aClassPath.substring(i, end); ! String [] files = list(pathname, packageDirectory); ! if(files != null) { ! result.addAll(Arrays.asList(files)); ! } ! i = end + 1; ! } ! return (String [])result.toArray(new String[0]); ! } ! } |
From: Nick F. <nfo...@us...> - 2002-07-10 15:03:05
|
Update of /cvsroot/pizzacompiler/pizza In directory usw-pr-cvs1:/tmp/cvs-serv17388 Modified Files: build.xml Log Message: fixed defect whereby Jars on the classpath were being kept open too long Index: build.xml =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/build.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** build.xml 14 Feb 2002 18:04:42 -0000 1.5 --- build.xml 10 Jul 2002 15:03:00 -0000 1.6 *************** *** 33,37 **** <pathelement location="${pizza_jar}"/> <fileset dir="${tests.lib}"> ! <include name="**/*.jar"/> </fileset> </path> --- 33,37 ---- <pathelement location="${pizza_jar}"/> <fileset dir="${tests.lib}"> ! <include name="*.jar"/> </fileset> </path> |
From: Nick F. <nfo...@us...> - 2002-07-10 15:03:05
|
Update of /cvsroot/pizzacompiler/pizza/tests/src/acceptance/net/sf/pizzacompiler In directory usw-pr-cvs1:/tmp/cvs-serv17388/tests/src/acceptance/net/sf/pizzacompiler Modified Files: CompilerMessagesTest.java Log Message: fixed defect whereby Jars on the classpath were being kept open too long Index: CompilerMessagesTest.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/acceptance/net/sf/pizzacompiler/CompilerMessagesTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CompilerMessagesTest.java 8 Mar 2002 12:31:24 -0000 1.11 --- CompilerMessagesTest.java 10 Jul 2002 15:03:01 -0000 1.12 *************** *** 92,100 **** } - public void testVariableScopeInSwitch() throws IOException { - testWarning(this, "SwitchVariableScope.java", new Position(8, 5), - "variable c not found in class SwitchVariableScope", false); - } - // // helper code for tests --- 92,95 ---- |
From: Nick F. <nfo...@us...> - 2002-07-10 15:03:05
|
Update of /cvsroot/pizzacompiler/pizza/bootstrap In directory usw-pr-cvs1:/tmp/cvs-serv17388/bootstrap Modified Files: pizza_ant.jar pizzaself.jar Log Message: fixed defect whereby Jars on the classpath were being kept open too long Index: pizza_ant.jar =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/bootstrap/pizza_ant.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsTD3qKw and /tmp/cvsqNZ8fT differ Index: pizzaself.jar =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/bootstrap/pizzaself.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsR5fW4y and /tmp/cvsggAlJ1 differ |
From: Enno R. <enn...@us...> - 2002-05-15 20:42:39
|
Update of /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv5261/main/src/net/sf/pizzacompiler/compiler Modified Files: Attr.pizza Checks.pizza Log Message: added check for multiple catches (Bug 509769) Index: Attr.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/Attr.pizza,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Attr.pizza 6 Dec 2001 11:46:37 -0000 1.4 --- Attr.pizza 15 May 2002 20:42:34 -0000 1.5 *************** *** 672,675 **** --- 672,676 ---- tryEnv.info.reported, catchers[i].param.type); sofar = attribStat(body, tryEnv, pt, sofar); + Checks.checkMonotonicCatches(catchers); break; Index: Checks.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/main/src/net/sf/pizzacompiler/compiler/Checks.pizza,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Checks.pizza 29 Aug 2001 15:35:42 -0000 1.1.1.1 --- Checks.pizza 15 May 2002 20:42:34 -0000 1.2 *************** *** 15,18 **** --- 15,20 ---- import Type.*; import List.*; + import AST.Catch; + import AST.VarDef; class Checks implements Constants { *************** *** 348,351 **** --- 350,369 ---- if (unhandled != null) checkHandled(pos, unhandled, reported); } + + /** + * Make sure catches cover exceptions monotonicly. + */ + static void checkMonotonicCatches(Catch[] catchers) { + for (int i = 0; i < catchers.length; i++) { + Type exceptionType = catchers[i].param.vartype.type; + for (int j = i + 1; j < catchers.length; j++) { + Type exceptionTypeBehind = catchers[j].param.vartype.type; + if (exceptionTypeBehind.subtype(exceptionType)) { + Report.error(catchers[j].pos, "exception " + exceptionTypeBehind + " has already been caught"); + } + } + } + } + static void checkMono(int pos, ClassSymbol c) { Symbol e = c.locals().elems; |
From: Enno R. <enn...@us...> - 2002-05-15 20:42:38
|
Update of /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv5261/tests/src/unit/net/sf/pizzacompiler/compiler Modified Files: AllUnitTests.java TypeTest.pizza Added Files: MultipleCatchTest.pizza Log Message: added check for multiple catches (Bug 509769) --- NEW FILE: MultipleCatchTest.pizza --- package net.sf.pizzacompiler.compiler; /** * $Id: MultipleCatchTest.pizza,v 1.1 2002/05/15 20:42:34 ennorunne Exp $ * * Copyright (C) 2002 Enno Runne * This software is distributed under the Artistic License. See * artistic.html or artistic.txt which came with this distribution. */ import junit.framework.TestCase; import java.util.Collections; import java.io.PrintStream; import java.io.ByteArrayOutputStream; import net.sf.pizzacompiler.lang.Pair; public class MultipleCatchTest extends TestCase { private final String OK_CODE_1 = "public class Test { \n"+ "void doIt() { \n"+ "try {\n" + " int i = 6 / 3;\n"+ "}\n" + "catch (NullPointerException e) { }\n"+ "catch (Exception e) { }\n"+ "}}"; private final String BUG_CODE_1 = "public class Test { \n"+ "void doIt() { \n"+ "try {\n" + " int i = 6 / 3;\n"+ "}\n" + "catch (NullPointerException e) { }\n"+ "catch (NullPointerException e) { }\n"+ "}}"; private final String BUG_CODE_2 = "public class Test { \n"+ "void doIt() { \n"+ "try {\n" + " int i = 6 / 3;\n"+ "}\n" + "catch (Exception e) { }\n"+ "catch (NullPointerException e) { }\n"+ "}}"; public MultipleCatchTest(String s) { super(s); } private PrintStream errorOut; public void setUp() { errorOut = new PrintStream(new ByteArrayOutputStream()); } public void testMultipleCatchOk() { final String CLASS_NAME = "Test.pizza"; MapSourceReader source = new MapSourceReader(Collections.singletonMap(CLASS_NAME, OK_CODE_1)); Main.init(); Main.compile(new String[]{CLASS_NAME}, source, new FileCompilerOutput(null), errorOut); assertTrue(Report.getErrorsAndWarnings().isEmpty()); } public void testMultipleNullPointerException() { final String CLASS_NAME = "Test.pizza"; MapSourceReader source = new MapSourceReader(Collections.singletonMap(CLASS_NAME, BUG_CODE_1)); Main.init(); Main.compile(new String[]{CLASS_NAME}, source, new FileCompilerOutput(null), errorOut); assertEquals(1, Report.getErrorsAndWarnings().size()); } public void testExceptionNullPointerException() { final String CLASS_NAME = "Test.pizza"; MapSourceReader source = new MapSourceReader(Collections.singletonMap(CLASS_NAME, BUG_CODE_2)); Main.init(); Main.compile(new String[]{CLASS_NAME}, source, new FileCompilerOutput(null), errorOut); assertEquals(1, Report.getErrorsAndWarnings().size()); } } Index: AllUnitTests.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler/AllUnitTests.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AllUnitTests.java 31 Oct 2001 16:38:59 -0000 1.5 --- AllUnitTests.java 15 May 2002 20:42:34 -0000 1.6 *************** *** 8,12 **** * artistic.html or artistic.txt which came with this distribution. * - * Created: Fri Sep 14 10:22:42 2001 */ --- 8,11 ---- *************** *** 23,26 **** --- 22,26 ---- suite.addTest(new TestSuite(MainTest.class)); suite.addTest(new TestSuite(MapSourceReaderTest.class)); + suite.addTest(new TestSuite(MultipleCatchTest.class)); suite.addTest(new TestSuite(PositionTest.class)); suite.addTest(new TestSuite(ReportTest.class)); Index: TypeTest.pizza =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/unit/net/sf/pizzacompiler/compiler/TypeTest.pizza,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TypeTest.pizza 8 Mar 2002 19:47:04 -0000 1.2 --- TypeTest.pizza 15 May 2002 20:42:34 -0000 1.3 *************** *** 29,32 **** --- 29,43 ---- super(s); } + + private boolean defaultSwitchPizza; + + public void setUp() { + defaultSwitchPizza = Switches.pizza; + Switches.pizza = true; + } + + public void tearDown() { + Switches.pizza = defaultSwitchPizza; + } public void testOldPizzaLangCharacterType() { *************** *** 34,38 **** MapSourceReader source = new MapSourceReader(Collections.singletonMap(CLASS_NAME, BUG_473078_CODE)); Main.init(); - Switches.pizza = true; Main.compile(new String[]{CLASS_NAME}, source, new FileCompilerOutput(null), null); assertTrue(Report.getErrorsAndWarnings().isEmpty()); --- 45,48 ---- *************** *** 52,53 **** --- 62,64 ---- } }// TypeTest + |
From: Nick F. <nfo...@us...> - 2002-03-08 19:47:08
|
Update of /cvsroot/pizzacompiler/pizza/tests/src/acceptance/net/sf/pizzacompiler In directory usw-pr-cvs1:/tmp/cvs-serv11494/tests/src/acceptance/net/sf/pizzacompiler Modified Files: AllAcceptanceTests.java Added Files: ArrayTest.java Log Message: fixed defect 525972. Arrays can now be checked for Cloneable and Serializable properly. --- NEW FILE: ArrayTest.java --- package net.sf.pizzacompiler; /** * $Id: ArrayTest.java,v 1.1 2002/03/08 19:47:04 nfortescue Exp $ * * Copyright (C) 2001 Nicolas Fortescue. * This software is distributed under the Artistic License. See * artistic.html or artistic.txt which came with this distribution. * * Created: Fri Mar 08 19:27:41 2002 */ import junit.framework.TestCase; import net.sf.pizzacompiler.compiler.ByteArrayClassLoader; import java.lang.reflect.Method; import java.util.*; public class ArrayTest extends TestCase { public ArrayTest(String s){ super(s); } private static final String ARRAYCLASSNAME = "ArrayCode"; private static final String CLONEMETHOD = "cloneArray"; private static final String arraySource = "public class "+ARRAYCLASSNAME+" {\n" + " public static int [] "+CLONEMETHOD+"(int[] array) {\n" + " return (int[])array.clone();\n" + " }\n"+ "}\n"; public void testClone() throws Exception { byte [] code = CompilerTestMethods.compileSourceToBytes(ARRAYCLASSNAME, arraySource, false); ClassLoader cl = new ByteArrayClassLoader(this.getClass().getClassLoader(), Collections.singleton(code)); Class clazz = cl.loadClass(ARRAYCLASSNAME); int [] original = new int[]{1,2,3}; Method method = clazz.getMethod(CLONEMETHOD, new Class[]{original.getClass()}); int [] result = (int [])method.invoke(null, new Object[]{original}); assertTrue(original != result); assertTrue(Arrays.equals(original, result)); } }// ArrayTest Index: AllAcceptanceTests.java =================================================================== RCS file: /cvsroot/pizzacompiler/pizza/tests/src/acceptance/net/sf/pizzacompiler/AllAcceptanceTests.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AllAcceptanceTests.java 14 Feb 2002 18:04:44 -0000 1.8 --- AllAcceptanceTests.java 8 Mar 2002 19:47:04 -0000 1.9 *************** *** 16,19 **** --- 16,20 ---- public static Test suite() { TestSuite suite = new TestSuite(); + suite.addTest(new TestSuite(ArrayTest.class)); suite.addTest(new TestSuite(ClassAndSourceOutputTests.class)); suite.addTest(new TestSuite(ClasspathOptionsTest.class)); |