summaryrefslogtreecommitdiff
path: root/sources/scalac/util
diff options
context:
space:
mode:
Diffstat (limited to 'sources/scalac/util')
-rw-r--r--sources/scalac/util/AbstractFileReader.java113
-rw-r--r--sources/scalac/util/ArrayApply.java54
-rw-r--r--sources/scalac/util/Debug.java503
-rw-r--r--sources/scalac/util/EmptyPhase.java36
-rw-r--r--sources/scalac/util/FreshNameCreator.java58
-rw-r--r--sources/scalac/util/Name.java133
-rw-r--r--sources/scalac/util/NameTransformer.java100
-rw-r--r--sources/scalac/util/Names.java268
-rw-r--r--sources/scalac/util/OptionParser.java541
-rw-r--r--sources/scalac/util/PrefixMatcher.java114
-rw-r--r--sources/scalac/util/SourceRepresentation.java227
-rw-r--r--sources/scalac/util/Strings.java102
-rw-r--r--sources/scalac/util/TermName.java119
-rw-r--r--sources/scalac/util/TypeName.java36
-rw-r--r--sources/scalac/util/TypeNames.java16
15 files changed, 0 insertions, 2420 deletions
diff --git a/sources/scalac/util/AbstractFileReader.java b/sources/scalac/util/AbstractFileReader.java
deleted file mode 100644
index bf3d6f437d..0000000000
--- a/sources/scalac/util/AbstractFileReader.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-** **
-** $Id$
-\* */
-
-package scalac.util;
-
-import java.io.IOException;
-
-import scala.tools.util.AbstractFile;
-
-public class AbstractFileReader {
-
- /** the buffer containing the file
- */
- public byte[] buf;
-
- /** the current input pointer
- */
- public int bp;
-
- /** the file path name
- */
- public final String path;
-
- /** constructor
- */
- public AbstractFileReader(AbstractFile f) throws IOException {
- buf = f.read();
- bp = 0;
- path = f.getPath();
- }
-
- /** return byte at offset 'pos'
- */
- public byte byteAt(int pos) {
- return buf[pos];
- }
-
- /** read a byte
- */
- public byte nextByte() {
- return buf[bp++];
- }
-
- /** read some bytes
- */
- public byte[] nextBytes(int len) {
- byte[] res = new byte[len];
- System.arraycopy(buf, bp, res, 0, len);
- bp += len;
- return res;
- }
-
- /** read a character
- */
- public char nextChar() {
- return
- (char)(((buf[bp++] & 0xff) << 8) +
- (buf[bp++] & 0xff));
- }
-
- /** read an integer
- */
- public int nextInt() {
- return ((buf[bp++] & 0xff) << 24) +
- ((buf[bp++] & 0xff) << 16) +
- ((buf[bp++] & 0xff) << 8) +
- (buf[bp++] & 0xff);
- }
-
- /** extract a character at position bp from buf
- */
- public char getChar(int mybp) {
- return (char)(((buf[mybp] & 0xff) << 8) + (buf[mybp+1] & 0xff));
- }
-
- /** extract an integer at position bp from buf
- */
- public int getInt(int mybp) {
- return ((buf[mybp ] & 0xff) << 24) +
- ((buf[mybp+1] & 0xff) << 16) +
- ((buf[mybp+2] & 0xff) << 8) +
- (buf[mybp+3] & 0xff);
- }
-
- /** extract a long integer at position bp from buf
- */
- public long getLong(int mybp) {
- return ((long)(getInt(mybp)) << 32) + (getInt(mybp + 4) & 0xffffffffL);
- }
-
- /** extract a float at position bp from buf
- */
- public strictfp float getFloat(int mybp) {
- return Float.intBitsToFloat(getInt(mybp));
- }
-
- /** extract a double at position bp from buf
- */
- public strictfp double getDouble(int mybp) {
- return Double.longBitsToDouble(getLong(mybp));
- }
-
- /** skip next 'n' bytes
- */
- public void skip(int n) {
- bp += n;
- }
-}
diff --git a/sources/scalac/util/ArrayApply.java b/sources/scalac/util/ArrayApply.java
deleted file mode 100644
index 087278af5b..0000000000
--- a/sources/scalac/util/ArrayApply.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-public abstract class ArrayApply {
-
- //########################################################################
- // Arrays interface - Object
-
- public static String toString(Object[] src) {
- return append(new StringBuffer(), src).toString();
- }
-
- public static String toString(Object[] src, String infix) {
- return append(new StringBuffer(), src, infix).toString();
- }
-
- public static String toString(Object[] src, String prefix, String infix,
- String suffix)
- {
- return append(new StringBuffer(), src, prefix,infix,suffix).toString();
- }
-
- //########################################################################
- // Arrays interface - StringBuffer
-
- public static StringBuffer append(StringBuffer buffer, Object[] src) {
- return append(buffer, src, "[", ",", "]");
- }
-
- public static StringBuffer append(StringBuffer buffer, Object[] src,
- String infix)
- {
- return append(buffer, src, "", infix, "");
- }
-
- public static StringBuffer append(StringBuffer buffer, Object[] src,
- String prefix, String infix, String suffix)
- {
- buffer.append(prefix);
- for (int i = 0; i < src.length; i++) {
- if (i > 0) buffer.append(infix);
- buffer.append(src[i]);
- }
- buffer.append(suffix);
- return buffer;
- }
-}
diff --git a/sources/scalac/util/Debug.java b/sources/scalac/util/Debug.java
deleted file mode 100644
index 3e889beb62..0000000000
--- a/sources/scalac/util/Debug.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002-2005, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-import scala.tools.util.debug.Debugger;
-import scala.tools.util.debug.ToStringDebugger;
-
-import scalac.Global;
-import scalac.ast.Tree;
-import scalac.symtab.Modifiers;
-import scalac.symtab.Scope;
-import scalac.symtab.Symbol;
-import scalac.symtab.Type;
-
-/**
- * Debugging class, used e.g. to obtain string representations of
- * compiler data structures that are not "pretty-printed" and thus
- * easier to relate to the source code.
- *
- * All methods are static to be easily useable in any context.
- *
- * @author Michel Schinz
- * @version 1.0
- */
-public class Debug extends scala.tools.util.debug.Debug {
-
- //########################################################################
- // Private Initialization
-
- /**
- * Forces the initialization of this class. Returns the boolean
- * value true so that it can be invoked from an assert statement.
- */
- public static boolean initialize() {
- // nothing to do, everything is done in the static initializer
- return true;
- }
-
- static {
- addDebugger(new ToStringDebugger(Tree.class));
- addDebugger(new ToStringDebugger(Type.class));
- addDebugger(SymbolDebugger.object);
- addDebugger(ScopeDebugger.object);
- }
-
- //########################################################################
- // Public Methods - Logging
-
- public static boolean log(Object a) {
- return logAll(new Object[] {a});
- }
-
- public static boolean log(Object a, Object b) {
- return logAll(new Object[] {a, b});
- }
-
- public static boolean log(Object a, Object b, Object c) {
- return logAll(new Object[] {a, b, c});
- }
-
- public static boolean log(Object a, Object b, Object c, Object d) {
- return logAll(new Object[] {a, b, c, d});
- }
-
- public static boolean logAll(Object[] args) {
- return Global.instance.log(showAll(args, null));
- }
-
- //########################################################################
- // showTree
-
- private static void append(StringBuffer buf, Name[] names) {
- for (int i = 0; i < names.length; i++) {
- if (i > 0) buf.append(",");
- append(buf, names[i]);
- }
- }
-
- private static void append(StringBuffer buf, Name name) {
- buf.append("\"" + name + '"');
- }
-
- private static void append(StringBuffer buf, String str) {
- buf.append("\"" + str + '"');
- }
-
- private static void append(StringBuffer buf, Tree[] trees, boolean showType) {
- buf.append('[');
- for (int i = 0; i < trees.length; i++) {
- if (i > 0) buf.append(',');
- append(buf, trees[i], showType);
- }
- buf.append(']');
- }
-
- private static void append(StringBuffer buf, Tree[][] trees) {
- for (int i = 0; i < trees.length; i++) {
- buf.append('[');
- append(buf, trees[i]);
- buf.append(']');
- }
- }
-
- private static void append(StringBuffer buf, Tree tree, boolean showType) {
- switch (tree) {
- case Empty:
- buf.append("Empty(");
- break;
- case Attributed(Tree attribute, Tree definition):
- buf.append("Attributed(");
- append(buf, attribute);
- buf.append(',');
- append(buf, definition);
- break;
- case DocDef(String comment, Tree definition):
- buf.append("DocDef(");
- append(buf, comment);
- buf.append(',');
- append(buf, definition);
- break;
- case ClassDef(int mods, Name name, Tree.AbsTypeDef[] tparams,
- Tree.ValDef[][] vparams, Tree tpe, Tree.Template impl):
- buf.append("ClassDef(");
- Modifiers.Helper.toString(buf, mods);
- buf.append(',');
- append(buf, name);
- buf.append(',');
- append(buf, tparams);
- buf.append(',');
- append(buf, vparams);
- buf.append(',');
- append(buf, tpe);
- buf.append(',');
- append(buf, impl);
- break;
- case PackageDef(Tree packaged, Tree.Template impl):
- buf.append("PackageDef(");
- append(buf, packaged);
- buf.append(',');
- append(buf, impl);
- break;
- case ModuleDef(int mods, Name name, Tree tpe, Tree.Template impl):
- buf.append("ModuleDef(");
- Modifiers.Helper.toString(buf, mods);
- buf.append(',');
- append(buf, name);
- buf.append(',');
- append(buf, tpe);
- buf.append(',');
- append(buf, impl);
- break;
- case ValDef(int mods, Name name, Tree tpe, Tree rhs):
- buf.append("ValDef(");
- Modifiers.Helper.toString(buf, mods);
- buf.append(',');
- append(buf, name);
- buf.append(',');
- append(buf, tpe, showType);
- buf.append(',');
- append(buf, rhs, showType);
- break;
- case PatDef(int mods, Tree pat, Tree rhs):
- buf.append("PatDef(");
- Modifiers.Helper.toString(buf, mods);
- buf.append(',');
- append(buf, pat);
- buf.append(',');
- append(buf, rhs);
- break;
- case DefDef(int mods, Name name, Tree.AbsTypeDef[] tparams,
- Tree.ValDef[][] vparams, Tree tpe, Tree rhs):
- buf.append("DefDef(");
- Modifiers.Helper.toString(buf, mods);
- buf.append(',');
- append(buf, name);
- buf.append(',');
- append(buf, tparams);
- buf.append(',');
- append(buf, vparams);
- buf.append(',');
- append(buf, tpe);
- buf.append(',');
- append(buf, rhs);
- break;
- case AbsTypeDef(int mods, Name name, Tree rhs, Tree lobound):
- buf.append("AbsTypeDef(");
- Modifiers.Helper.toString(buf, mods);
- buf.append(',');
- append(buf, name);
- buf.append(',');
- append(buf, rhs);
- buf.append(',');
- append(buf, lobound);
- break;
- case AliasTypeDef(int mods, Name name, Tree.AbsTypeDef[] tparams, Tree rhs):
- buf.append("AliasTypeDef(");
- Modifiers.Helper.toString(buf, mods);
- buf.append(',');
- append(buf, name);
- buf.append(',');
- append(buf, tparams);
- buf.append(',');
- append(buf, rhs);
- break;
- case Import(Tree expr, Name[] selectors):
- buf.append("Import(");
- append(buf, expr);
- buf.append(",");
- append(buf, selectors);
- break;
- case CaseDef(Tree pat, Tree guard, Tree body):
- buf.append("CaseDef(");
- buf.append(",");
- append(buf, pat);
- buf.append(",");
- append(buf, guard);
- buf.append(",");
- append(buf, body);
- break;
- case Template(Tree[] parents, Tree[] body):
- buf.append("Template(");
- append(buf, parents);
- buf.append(',');
- append(buf, body);
- break;
- case LabelDef(Name name, Tree.Ident[] params, Tree rhs):
- buf.append("LabelDef(");
- buf.append(",");
- append(buf, name);
- buf.append(',');
- append(buf, params);
- buf.append(',');
- append(buf, rhs);
- break;
- case Block(Tree[] stats, Tree expr):
- buf.append("Block(");
- append(buf, stats);
- buf.append(',');
- append(buf, expr);
- break;
- case Sequence(Tree[] trees):
- buf.append("Sequence(");
- buf.append(',');
- append(buf, trees);
- break;
- case Alternative(Tree[] trees):
- buf.append("Alternative(");
- buf.append(',');
- append(buf, trees);
- break;
- case Bind(Name name, Tree rhs):
- buf.append("Bind(");
- append(buf, name);
- buf.append(',');
- append(buf, rhs);
- break;
- case Visitor(Tree.CaseDef[] cases):
- buf.append("ClassDef(");
- append(buf, cases);
- break;
- case Function(Tree.ValDef[] vparams, Tree body):
- buf.append("Function(");
- append(buf, vparams);
- buf.append(',');
- append(buf, body);
- break;
- case Assign(Tree lhs, Tree rhs):
- buf.append("Assign(");
- append(buf, lhs);
- buf.append(',');
- append(buf, rhs);
- break;
- case If(Tree cond, Tree thenp, Tree elsep):
- buf.append("If(");
- append(buf, cond);
- buf.append(',');
- append(buf, thenp);
- buf.append(',');
- append(buf, elsep);
- break;
- case Switch(Tree test, int[] tags, Tree[] bodies, Tree otherwise):
- buf.append("Switch(");
- buf.append(',');
- append(buf, test);
- buf.append(',');
- buf.append(tags); // TODO
- buf.append(',');
- append(buf, bodies);
- buf.append(",");
- append(buf, otherwise);
- break;
- case Return(Tree expr):
- buf.append("Return(");
- append(buf, expr, showType);
- buf.append(')');
- break;
- case Throw(Tree expr):
- buf.append("Throw(");
- append(buf, expr, showType);
- break;
- case New(Tree init):
- buf.append("New(");
- append(buf, init, showType);
- break;
- case Create(Tree qualifier, Tree[] targs):
- buf.append("Create(");
- append(buf, qualifier);
- buf.append(',');
- append(buf, targs);
- break;
- case Typed(Tree expr, Tree tpe):
- buf.append("Typed(");
- append(buf, expr, showType);
- buf.append(",");
- append(buf, tpe, showType);
- break;
- case TypeApply(Tree fun, Tree[] args):
- buf.append("TypeApply(");
- append(buf, fun, showType);
- buf.append(',');
- append(buf, args, showType);
- break;
- case Apply(Tree fun, Tree[] args):
- buf.append("Apply(");
- append(buf, fun, showType);
- buf.append(',');
- append(buf, args, showType);
- break;
- case Super(Name qualifier, Name mixin):
- buf.append("Super(");
- append(buf, qualifier);
- buf.append(',');
- append(buf, mixin);
- break;
- case This(Name qualifier):
- buf.append("This(");
- append(buf, qualifier);
- break;
- case Select(Tree qualifier, Name selector):
- buf.append("Select(");
- append(buf, qualifier, showType);
- buf.append(',');
- append(buf, selector);
- break;
- case Ident(Name name):
- buf.append("Ident(");
- append(buf, name);
- break;
- case Literal(scalac.atree.AConstant value):
- buf.append("Literal(" + value);
- break;
- case TypeTerm():
- buf.append("TypeTerm(");
- break;
- case SingletonType(Tree ref):
- buf.append("SingletonType(");
- append(buf, ref, showType);
- break;
- case SelectFromType(Tree qualifier, Name selector):
- buf.append("SelectFromType(");
- append(buf, qualifier, showType);
- buf.append(',');
- append(buf, selector);
- break;
- case FunType(Tree[] argtpes, Tree restpe):
- buf.append("FunType(");
- append(buf, argtpes);
- buf.append(',');
- append(buf, restpe);
- break;
- case CompoundType(Tree[] parents, Tree[] refinements):
- buf.append("CompoundType(");
- append(buf, parents);
- buf.append(',');
- append(buf, refinements);
- break;
- case AppliedType(Tree tpe, Tree[] args):
- buf.append("AppliedType(");
- append(buf, tpe);
- buf.append(',');
- append(buf, args);
- break;
- case Try(Tree block, Tree catcher, Tree finalizer):
- buf.append("Try(");
- append(buf, block);
- buf.append(',');
- append(buf, catcher);
- buf.append(',');
- append(buf, finalizer);
- break;
- default:
- buf.append(tree.getClass().getName() + "(");
- }
- buf.append(')');
- if (showType) buf.append(":" + tree.type);
- }
-
- public static String showTree(Tree tree, boolean showType) {
- StringBuffer buf = new StringBuffer();
- append(buf, tree, showType);
- return buf.toString();
- }
-
- public static String showTree(Tree tree) {
- return showTree(tree, false);
- }
-
- public static String showTree(Tree[] trees, boolean showType) {
- StringBuffer buf = new StringBuffer();
- append(buf, trees, showType);
- return buf.toString();
- }
-
- public static String showTree(Tree[] trees) {
- return showTree(trees, false);
- }
-
- //########################################################################
-}
-
-/** This class implements a debugger for symbols. */
-public class SymbolDebugger implements Debugger {
-
- //########################################################################
- // Public Constants
-
- /** The unique instance of this class. */
- public static final SymbolDebugger object = new SymbolDebugger();
-
- //########################################################################
- // Protected Constructors
-
- /** Initializes this instance. */
- protected SymbolDebugger() {}
-
- //########################################################################
- // Public Methods
-
- public boolean canAppend(Object object) {
- return object instanceof Symbol;
- }
-
- public void append(StringBuffer buffer, Object object) {
- Symbol symbol = (Symbol)object;
- if (!symbol.isNone() && !symbol.owner().isRoot() && !symbol.isRoot()) {
- Debug.append(buffer, symbol.owner());
- buffer.append(".");
- }
- buffer.append(symbol.name);
- if (Global.instance.uniqid) {
- buffer.append('#');
- buffer.append(symbol.id);
- }
- if (symbol.isConstructor()) {
- buffer.append('(');
- buffer.append(symbol.constructorClass().name);
- buffer.append(')');
- }
- }
-
- //########################################################################
-}
-
-/** This class implements a debugger for scopes. */
-public class ScopeDebugger implements Debugger {
-
- //########################################################################
- // Public Constants
-
- /** The unique instance of this class. */
- public static final ScopeDebugger object = new ScopeDebugger();
-
- //########################################################################
- // Protected Constructors
-
- /** Initializes this instance. */
- protected ScopeDebugger() {}
-
- //########################################################################
- // Public Methods
-
- public boolean canAppend(Object object) {
- return object instanceof Scope;
- }
-
- public void append(StringBuffer buffer, Object object) {
- Scope scope = (Scope)object;
- buffer.append('{');
- for (Scope.SymbolIterator i = scope.iterator(); i.hasNext();) {
- Debug.append(buffer, i.next());
- if (i.hasNext()) buffer.append(',');
- }
- buffer.append('}');
- }
-
- //########################################################################
-}
diff --git a/sources/scalac/util/EmptyPhase.java b/sources/scalac/util/EmptyPhase.java
deleted file mode 100644
index 5600fc85b9..0000000000
--- a/sources/scalac/util/EmptyPhase.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-import scalac.Global;
-import scalac.Phase;
-import scalac.PhaseDescriptor;
-import scalac.CompilationUnit;
-
-/** This class implements a phase that does nothing. */
-public class EmptyPhase extends Phase {
-
- //########################################################################
- // Public Constructors
-
- /** Initializes this instance. */
- public EmptyPhase(Global global, PhaseDescriptor descriptor) {
- super(global, descriptor);
- }
-
- //########################################################################
- // Public Methods
-
- /** Applies this phase to the given compilation unit. */
- public void apply(CompilationUnit unit) {
- // do nothing
- }
-
- //########################################################################
-}
diff --git a/sources/scalac/util/FreshNameCreator.java b/sources/scalac/util/FreshNameCreator.java
deleted file mode 100644
index 3675f359f0..0000000000
--- a/sources/scalac/util/FreshNameCreator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-import java.util.HashMap;
-
-public class FreshNameCreator {
-
- protected int counter = 0;
- protected HashMap counters = new HashMap();
-
- /**
- * Create a fresh name with the given prefix. It is guaranteed
- * that the returned name has never been returned by a previous
- * call to this function with the same separator character (which
- * has to be a non-digit).
- */
- public Name newName(String prefix, char separator) {
- prefix += separator;
- Integer ival = (Integer)counters.get(prefix);
- if (ival == null)
- counters.put(prefix, ival = new Integer(0));
- else
- counters.put(prefix, ival = new Integer(ival.intValue() + 1));
- return Name.fromString(prefix + ival);
- }
-
- /** Same, with `$' as the separator character
- */
- public Name newName(String prefix) {
- return newName(prefix, '$');
- }
-
- /** Same, but with a name as prefix. The new name is a type
- * (respectively, constructor) name if the prefix is one.
- */
- public Name newName(Name prefixName, char separator) {
- Name name = newName(prefixName.toString(), separator);
- if (prefixName.isTypeName()) return name.toTypeName();
- else return name;
- }
-
- /** Same, with `$' as the separator character
- */
- public Name newName(Name prefix) {
- return newName(prefix, '$');
- }
-
- public Name newName() {
- return Name.fromString("$" + (counter++) + "$");
- }
-}
diff --git a/sources/scalac/util/Name.java b/sources/scalac/util/Name.java
deleted file mode 100644
index af088d6f79..0000000000
--- a/sources/scalac/util/Name.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-/** This class implements the common part of TermName and TypeName. */
-public abstract class Name {
-
- //########################################################################
- // Public Fields
-
- /** The unique identifier */
- public final int index;
-
- //########################################################################
- // Private Fields
-
- /** The related term name */
- private final TermName term;
-
- /** The related type name (null if not yet created) */
- private TypeName type;
-
- //########################################################################
- // Protected Constructors
-
- /** Initializes this instance. */
- protected Name(int index, TermName term) {
- this.index = index;
- this.term = term == null ? (TermName)this : term;
- this.type = term == null ? null : (TypeName)this;
- }
-
- //########################################################################
- // Public Factories
-
- /** Returns the term name with given ASCII representation. */
- public static TermName fromAscii(byte[] bytes, int start, int count) {
- return TermName.fromAscii(bytes, start, count);
- }
-
- /** Returns the term name with given string representation. */
- public static TermName fromString(String string) {
- return TermName.fromString(string);
- }
-
- //########################################################################
- // Public Methods
-
- /** Is this name a variable identifier? */
- public final boolean isVariable() {
- char first = charAt(0);
- return (('a' <= first && first <= 'z') || first == '_')
- && this != Names.false_
- && this != Names.true_
- && this != Names.null_;
- }
-
- /** Is this name a term name? */
- public final boolean isTermName() {
- return this == term;
- }
-
- /** Is this name a type name? */
- public final boolean isTypeName() {
- return this == type;
- }
-
- /** Returns the term name with the same representation. */
- public final TermName toTermName() {
- return term;
- }
-
- /** Returns the type name with the same representation. */
- public final TypeName toTypeName() {
- return type != null ? type : (type = new TypeName(term));
- }
-
- /** Returns the result of "toString().length()". */
- public final int length() {
- return toString().length();
- }
-
- /** Returns the result of "toString().charAt(index)". */
- public final char charAt(int index) {
- return toString().charAt(index);
- }
-
- /** Returns the result of "toString().indexOf(ch)". */
- public final int indexOf(char ch) {
- return toString().indexOf(ch);
- }
-
- /** Returns the result of "toString().indexOf(ch, start)". */
- public final int indexOf(char ch, int start) {
- return toString().indexOf(ch, start);
- }
-
- /** Returns the result of "toString().lastIndexOf(ch)". */
- public final int lastIndexOf(char ch) {
- return toString().lastIndexOf(ch);
- }
-
- /** Returns the result of "toString().lastIndexOf(ch, start)". */
- public final int lastIndexOf(char ch, int start) {
- return toString().lastIndexOf(ch, start);
- }
-
- /** Returns the hash code of this name. */
- public final int hashCode() {
- return index;
- }
-
- /** Returns the string representation of this name. */
- public String toString() {
- return term.toString();
- }
-
- /**
- * Returns the ASCII representation of this name. The returned
- * array is not a copy. Therefore, it is forbidden to modify it.
- */
- public byte[] toAsciiUnsafe() {
- return term.toAsciiUnsafe();
- }
-
- //########################################################################
-}
diff --git a/sources/scalac/util/NameTransformer.java b/sources/scalac/util/NameTransformer.java
deleted file mode 100644
index b04b665379..0000000000
--- a/sources/scalac/util/NameTransformer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-** **
-** $Id$
-\* */
-
-package scalac.util;
-
-/** A name transformer for replacing operator symbols in names by predefined
- * names of the form $opname.
- *
- * @author Martin Odersky, Christine Roeckl
- * @version 1.1
- */
-public class NameTransformer {
-
- public static String[] operatorName = new String[128];
-
- static {
- operatorName['~'] = "$tilde";
- operatorName['='] = "$eq";
- operatorName['<'] = "$less";
- operatorName['>'] = "$greater";
- operatorName['!'] = "$bang";
- operatorName['#'] = "$hash";
- operatorName['%'] = "$percent";
- operatorName['^'] = "$up";
- operatorName['&'] = "$amp";
- operatorName['|'] = "$bar";
- operatorName['*'] = "$times";
- operatorName['/'] = "$div";
- operatorName['+'] = "$plus";
- operatorName['-'] = "$minus";
- operatorName[':'] = "$colon";
- operatorName['\\']= "$bslash";
- }
-
- /** Replace operator symbols by corresponding "$op_name" in names.
- */
- public static Name encode(Name name) {
- String string = name.toString();
- StringBuffer buffer = null;
- for (int i = 0; i < string.length(); i++) {
- char c = string.charAt(i);
- if (c < 128) {
- String operator = operatorName[c];
- if (operator != null) {
- if (buffer == null) {
- int capacity = string.length() - 1 + operator.length();
- buffer = new StringBuffer(capacity);
- buffer.append(string.substring(0, i));
- }
- buffer.append(operator);
- continue;
- }
- }
- if (buffer != null) buffer.append(c);
- }
- return buffer == null ? name : Name.fromString(buffer.toString());
- }
-
- /** Replace "$op_name" by corresponding operator symbols in names.
- */
- public static String decode(Name name) {
- return decode(name.toString());
- }
- public static String decode(String string) {
- StringBuffer buffer = null;
- for (int i = 0; i < string.length(); i++) {
- char c = string.charAt(i);
- if (c == '$') {
- int index = -1;
- int length = -1; // an operator may be a prefix of another one
- for (int j = 0; j < operatorName.length; j++) {
- String operator = operatorName[j];
- if (operator == null) continue;
- if (operator.length() <= length) continue;
- if (!string.startsWith(operator, i)) continue;
- index = j;
- length = operator.length();
- }
- if (length >= 0) {
- if (buffer == null) {
- int capacity = string.length() - length + 1;
- buffer = new StringBuffer(capacity);
- buffer.append(string.substring(0, i));
- }
- buffer.append((char)index);
- i += length - 1;
- continue;
- }
- }
- if (buffer != null) buffer.append(c);
- }
- return buffer == null ? string : buffer.toString();
- }
-
-}
diff --git a/sources/scalac/util/Names.java b/sources/scalac/util/Names.java
deleted file mode 100644
index 66a67f819c..0000000000
--- a/sources/scalac/util/Names.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002-2004, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-**
-** $Id$
-\* */
-package scalac.util;
-
-import scalac.symtab.Symbol;
-import scalac.symtab.SymbolNameWriter;
-import scalac.symtab.ClassSymbol;
-
-public class Names {
-
- private static final SymbolNameWriter writer =
- new SymbolNameWriter().setAllSeparators('$').setRootSeparator('\0');
-
- private static final String ALIAS_PREFIX = "alias$";
- private static final String LOCAL_PREFIX = "local$";
- private static final String MIXIN_PREFIX = "mixin$";
- private static final String OUTER_PREFIX = "outer$";
- private static final String SUPER_PREFIX = "super$";
- private static final String ACCESS_PREFIX = "access$";
- private static final String TUPLE_FIELD_PREFIX = "_";
- private static final String TYPE_PREFIX = "type$";
- private static final String INSTANTIATE_PREFIX = "instantiate$";
- private static final String LAZYPARENTS_PREFIX = "LazyParents$";
- private static final String TYPECONSTRUCTOR_PREFIX = "tConstructor$";
-
- public static Name ALIAS(ClassSymbol clasz) {
- return Name.fromString(ALIAS_PREFIX + clasz.name).toTypeName();
- }
-
- public static Name LOCAL(Symbol clasz) {
- return Name.fromString(LOCAL_PREFIX + clasz.name);
- }
-
- public static Name MIXIN(Symbol member) {
- Name name = Name.fromString(MIXIN_PREFIX + member.owner().name
- + (member.isInitializer() ? INLINED_INITIALIZER : member.name));
- if (member.name.isTypeName()) name = name.toTypeName();
- return name;
- }
-
- public static Name OUTER(Symbol constructor) {
- if (constructor.isClass())
- return Name.fromString(OUTER_PREFIX + constructor.owner().name);
- assert constructor.isConstructor(): Debug.show(constructor);
- Symbol clasz = constructor.constructorClass();
- Symbol[] constructors = clasz.allConstructors().alternativeSymbols();
- int index = 0;
- while (constructors[index] != constructor) index++;
- String name = OUTER_PREFIX + index +"$"+ clasz.owner().name;
- return Name.fromString(name);
- }
-
- public static Name OUTER(Symbol constructor, Symbol member) {
- Name name = Name.fromString(OUTER(constructor) + "$" + member.name);
- if (member.name.isTypeName()) name = name.toTypeName();
- return name;
- }
-
- public static Name ACCESS(Symbol member, boolean svper) {
- assert member.isTerm() && member.owner().isClass(): Debug.show(member);
- String prefix = svper ? ACCESS_PREFIX + SUPER_PREFIX : ACCESS_PREFIX;
- return Name.fromString(writer.toString(prefix, member));
- }
-
- public static Name TUPLE_FIELD(int index) {
- return Name.fromString(TUPLE_FIELD_PREFIX + index);
- }
-
- public static Name TYPE(Symbol sym) {
- return Name.fromString(TYPE_PREFIX + sym.name);
- }
-
- public static Name INSTANTIATE(Symbol sym, boolean isStatic) {
- return Name.fromString(INSTANTIATE_PREFIX
- + sym.name
- + (isStatic ? "$" : ""));
- }
-
- public static Name LAZYPARENTS(Symbol clsSym) {
- return Name.fromString(LAZYPARENTS_PREFIX + clsSym.name).toTypeName();
- }
-
- public static Name TYPECONSTRUCTOR(Symbol sym, boolean isStatic) {
- return Name.fromString(TYPECONSTRUCTOR_PREFIX
- + sym.name
- + (isStatic ? "$" : ""));
- }
-
- public static final Name ERROR = Name.fromString("<error>");
- public static final Name NOSYMBOL = Name.fromString("<none>");
- public static final Name EMPTY = Name.fromString("");
- public static final Name IMPORT_WILDCARD = Name.fromString("_");
- public static final Name PATTERN_WILDCARD = Name.fromString("_");
- public static final Name COMPOUND_NAME = Name.fromString("<ct>");
- public static final Name ANON_CLASS_NAME = Name.fromString("$anon");
- public static final Name ZERO = Name.fromString("<zero>");
- public static final Name STAR = Name.fromString("*");
- public static final Name ROOT = Name.fromString("<root>");
-
- public static final Name CONSTRUCTOR = Name.fromString("<init>");
- public static final Name CLASS_CONSTRUCTOR = Name.fromString("<clinit>");
- public static final Name INITIALIZER = Name.fromString("<init>");
- public static final Name INLINED_INITIALIZER = Name.fromString("$init$");
-
- public static final Name _EQ = encode("_=");
- public static final Name MINUS = encode("-");
- public static final Name PLUS = encode("+");
- public static final Name TILDE = encode("~");
- public static final Name EQEQ = encode("==");
- public static final Name BANG = encode("!");
- public static final Name BANGEQ = encode("!=");
- public static final Name BARBAR = encode("||");
- public static final Name AMPAMP = encode("&&");
- public static final Name COLONCOLON = encode("::");
- public static final Name PERCENT = encode("%");
- public static final Name PLUSEQ = encode("+=");
- public static final Name MINUSEQ = encode("-=");
-
- public static final Name All = Name.fromString("All");
- public static final Name AllRef = Name.fromString("AllRef");
- public static final Name Any = Name.fromString("Any");
- public static final Name AnyVal = Name.fromString("AnyVal");
- public static final Name AnyRef = Name.fromString("AnyRef");
- public static final Name Array = Name.fromString("Array");
- public static final Name Byte = Name.fromString("Byte");
- public static final Name CaseClass = Name.fromString("CaseClass");
- public static final Name Catch = Name.fromString("Catch");
- public static final Name Char = Name.fromString("Char");
- public static final Name Boolean = Name.fromString("Boolean");
- public static final Name Do = Name.fromString("Do");
- public static final Name Double = Name.fromString("Double");
- public static final Name Element = Name.fromString("Element");
- public static final Name Finally = Name.fromString("Finally");
- public static final Name Float = Name.fromString("Float");
- public static final Name Function = Name.fromString("Function");
- public static final Name GetType = Name.fromString("GetType");
- public static final Name Int = Name.fromString("Int");
- public static final Name Labelled = Name.fromString("Labelled");
- public static final Name List = Name.fromString("List");
- public static final Name Long = Name.fromString("Long");
- public static final Name Nil = Name.fromString("Nil");
- public static final Name Object = Name.fromString("Object");
- public static final Name PartialFunction = Name.fromString("PartialFunction");
- public static final Name Predef = Name.fromString("Predef");
- public static final Name ScalaObject = Name.fromString("ScalaObject");
- public static final Name ScalaRunTime = Name.fromString("ScalaRunTime");
- public static final Name Seq = Name.fromString("Seq");
- public static final Name Short = Name.fromString("Short");
- public static final Name String = Name.fromString("String");
- public static final Name Symbol = Name.fromString("Symbol");
- public static final Name Text = Name.fromString("Text");
- public static final Name Throwable = Name.fromString("Throwable");
- public static final Name Try = Name.fromString("Try");
- public static final Name Tuple = Name.fromString("Tuple");
- public static final Name Type = Name.fromString("Type");
- public static final Name Tuple2 = Name.fromString("Tuple2");
- public static final Name Unit = Name.fromString("Unit");
- public static final Name While = Name.fromString("While");
- public static final Name apply = Name.fromString("apply");
- public static final Name array = Name.fromString("array");
- public static final Name asInstanceOf = Name.fromString("asInstanceOf");
- public static final Name asInstanceOfE = Name.fromString("asInstanceOf$erased");
- public static final Name box = Name.fromString("box");
- public static final Name caseArity = Name.fromString("caseArity");
- public static final Name caseElement = Name.fromString("caseElement");
- public static final Name cur = Name.fromString("cur"); // used in translation of automata
- public static final Name cast = Name.fromString("cast");
- public static final Name clone = Name.fromString("clone");
- public static final Name coerce = Name.fromString("coerce");
- public static final Name defaultValue = Name.fromString("defaultValue");
- public static final Name elem = Name.fromString("elem");
- public static final Name elements = Name.fromString("elements");
- public static final Name emptyArray = Name.fromString("EMPTY_ARRAY");
- public static final Name eq = Name.fromString("eq");
- public static final Name equals = Name.fromString("equals");
- public static final Name fail = Name.fromString("fail");
- public static final Name false_ = Name.fromString("false");
- public static final Name filter = Name.fromString("filter");
- public static final Name finalize = Name.fromString("finalize");
- public static final Name flatmap = Name.fromString("flatMap");
- public static final Name foreach = Name.fromString("foreach");
- public static final Name force = Name.fromString("force");
- public static final Name functionOuter = Name.fromString("FUNCTION_OUTER");
- public static final Name get = Name.fromString("get");
- public static final Name getClass = Name.fromString("getClass");
- public static final Name getInstantiation = Name.fromString("getInstantiation");
- public static final Name getScalaType = Name.fromString("getScalaType");
- public static final Name isInstance = Name.fromString("isInstance");
- public static final Name hashCode = Name.fromString("hashCode");
- public static final Name hasNext = Name.fromString("hasNext");
- public static final Name head = Name.fromString("head");
- public static final Name isInstanceOf = Name.fromString("isInstanceOf");
- public static final Name isInstanceOfE = Name.fromString("isInstanceOf$erased");
- public static final Name isDefinedAt = Name.fromString("isDefinedAt");
- public static final Name isEmpty = Name.fromString("isEmpty");
- public static final Name instantiate = Name.fromString("instantiate");
- public static final Name java = Name.fromString("java");
- public static final Name javaRefArrayType = Name.fromString("javaRefArrayType");
- public static final Name javaArrayType = Name.fromString("javaArrayType");
- public static final Name javaClassType = Name.fromString("javaClassType");
- public static final Name lang = Name.fromString("lang");
- public static final Name length = Name.fromString("length");
- public static final Name _match = Name.fromString("match");
- public static final Name map = Name.fromString("map");
- public static final Name n = Name.fromString("n");
- public static final Name ne = Name.fromString("ne");
- public static final Name nobinding = Name.fromString("nobinding");
- public static final Name next = Name.fromString("next");
- public static final Name newArray = Name.fromString("newArray");
- public static final Name notify = Name.fromString("notify");
- public static final Name notifyAll = Name.fromString("notifyAll");
- public static final Name null_ = Name.fromString("null");
- public static final Name predef = Name.fromString("predef");
- public static final Name print = Name.fromString("print");
- public static final Name readResolve = Name.fromString("readResolve");
- public static final Name report = Name.fromString("report");
- public static final Name result = Name.fromString("$result");
- public static final Name runtime = Name.fromString("runtime");
- public static final Name scala = Name.fromString("scala");
- public static final Name setParents = Name.fromString("setParents");
- public static final Name synchronized_ = Name.fromString("synchronized");
- public static final Name tag = Name.fromString("$tag");
- public static final Name tail = Name.fromString("tail");
- public static final Name toString = Name.fromString("toString");
- public static final Name that = Name.fromString("that");
- public static final Name that1 = Name.fromString("that1");
- public static final Name this_ = Name.fromString("this");
- public static final Name throw_ = Name.fromString("throw");
- public static final Name true_ = Name.fromString("true");
- public static final Name update = Name.fromString("update");
- public static final Name view = Name.fromString("view");
- public static final Name wait = Name.fromString("wait");
- public static final Name isNonTrivialInstance = Name.fromString("isNonTrivialInstance");
- public static final Name xml = Name.fromString("xml");
-
-
- public static final Name
- ZNOT = encode("!"),
- ZAND = encode("&&"),
- ZOR = encode("||"),
- NOT = encode("~"),
- ADD = encode("+"),
- SUB = encode("-"),
- MUL = encode("*"),
- DIV = encode("/"),
- MOD = encode("%"),
- EQ = encode("=="),
- NE = encode("!="),
- LT = encode("<"),
- LE = encode("<="),
- GT = encode(">"),
- GE = encode(">="),
- OR = encode("|"),
- XOR = encode("^"),
- AND = encode("&"),
- LSL = encode("<<"),
- LSR = encode(">>>"),
- ASR = encode(">>");
-
- private static Name encode(String string) {
- return NameTransformer.encode(Name.fromString(string));
- }
-}
diff --git a/sources/scalac/util/OptionParser.java b/sources/scalac/util/OptionParser.java
deleted file mode 100644
index 9521ca388e..0000000000
--- a/sources/scalac/util/OptionParser.java
+++ /dev/null
@@ -1,541 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-import scala.tools.util.Position;
-import scala.tools.util.Reporter;
-
-import java.text.Format;
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-
-import scalac.PhaseDescriptor;
-//import scalac.optimizer.OptimizePhase;
-
-public class CommandParser {
-
- private final String product;
- private final String version;
- private final String syntax;
- private final Reporter reporter;
- private final List/*<ArgumentParser>*/ parsers;
-
- public CommandParser(String product, String version, String syntax,
- Reporter reporter)
- {
- this.product = product;
- this.version = version;
- this.syntax = syntax;
- this.reporter = reporter;
- this.parsers = new ArrayList();
- }
-
- public String product() {
- return product;
- }
-
- public String version() {
- return version;
- }
-
- public String syntax() {
- return syntax;
- }
-
- public Reporter reporter() {
- return reporter;
- }
-
- public boolean add(ArgumentParser parser) {
- return parsers.add(parser);
- }
-
- public void add(int index, ArgumentParser parser) {
- parsers.add(index, parser);
- }
-
- public boolean remove(ArgumentParser parser) {
- return parsers.remove(parser);
- }
-
- public List parsers() {
- return parsers;
- }
-
- public boolean parse(String[] args) {
- int errors = reporter.errors();
- for (int i = 0; i < args.length; ) {
- for (int j = 0; j < parsers.size(); j++) {
- ArgumentParser parser = (ArgumentParser)parsers.get(j);
- if (parser.matches(args, i)) {
- i = parser.consume(args, i);
- break;
- }
- }
- }
- return reporter.errors() == errors;
- }
-
- public String getHelpMessage() {
- Format format = new MessageFormat(" {0}\t {1}");
- List options = new ArrayList(parsers.size());
- for (int i = 0; i < parsers.size(); i++) {
- if (!(parsers.get(i) instanceof OptionParser)) continue;
- OptionParser parser = (OptionParser)parsers.get(i);
- String option = parser.getHelpMessage(format);
- if (option != null) options.add(option);
- }
- StringBuffer buffer = new StringBuffer();
- buffer.append("usage: ").append(product());
- if (options.size() > 0) buffer.append(" <options>");
- if (syntax != null) buffer.append(' ').append(syntax);
- buffer.append(Strings.EOL);
- if (options.size() > 0) {
- buffer.append("where possible options include:");
- buffer.append(Strings.EOL);
- buffer.append(Strings.format(options));
- }
- return buffer.toString();
- }
-
- public void error(String message) {
- reporter.error(new Position(product), message);
- }
-
- public void warning(String message) {
- reporter.warning(new Position(product), message);
- }
-}
-
-public abstract class ArgumentParser {
-
- public final CommandParser command;
-
- public ArgumentParser(CommandParser command) {
- this.command = command;
- }
-
- public abstract boolean matches(String[] args, int index);
- public abstract int consume(String[] args, int index);
-
-}
-
-public class UnknownArgumentParser extends ArgumentParser {
-
- public UnknownArgumentParser(CommandParser command) {
- super(command);
- }
-
- public boolean matches(String[] args, int index) {
- return true;
- }
-
- public int consume(String[] args, int index) {
- command.error("don't known what to do with '" + args[index] + "'");
- return index + 1;
- }
-}
-
-public class ScalaFileArgumentParser extends ArgumentParser {
-
- public final List list;
-
- public ScalaFileArgumentParser(CommandParser command) {
- super(command);
- this.list = new ArrayList();
- }
-
- public boolean matches(String[] args, int index) {
- return args[index].endsWith(".scala");
- }
-
- public int consume(String[] args, int index) {
- list.add(args[index]);
- return index + 1;
- }
-
- public String[] toArray() {
- return (String[])list.toArray(new String[list.size()]);
- }
-}
-
-public class ScalaProgramArgumentParser extends ArgumentParser {
-
- public String main;
- public String[] args;
-
- public ScalaProgramArgumentParser(CommandParser command) {
- super(command);
- }
-
- public boolean matches(String[] args, int index) {
- return args[index].equals("--");
- }
-
- public int consume(String[] args, int index) {
- if (index + 1 < args.length) {
- this.main = args[index + 1];
- this.args = new String[args.length - index - 2];
- System.arraycopy(args, index + 2, this.args, 0, this.args.length);
- return args.length;
- } else {
- command.error("option --: missing module name");
- return args.length;
- }
- }
-}
-
-public abstract class OptionParser extends ArgumentParser {
-
- public final String option;
- public final String description;
-
- public OptionParser(CommandParser command, String option,
- String description)
- {
- super(command);
- this.option = option;
- this.description = description;
- }
-
- public String getHelpSyntax() {
- return "-" + option;
- }
-
- public String getHelpDescription() {
- return description;
- }
-
- public void getHelpMessageArgs(List args) {
- args.add(getHelpSyntax());
- args.add(getHelpDescription());
- }
-
- public String getHelpMessage(Format format) {
- if (description == null) return null;
- List args = new ArrayList();
- getHelpMessageArgs(args);
- return format.format(args.toArray());
- }
-
- public void error(String message) {
- command.error("option -" + option + ": " + message);
- }
-
- public void warning(String message) {
- command.warning("option -" + option + ": " + message);
- }
-}
-/*
-public class OptimizeOptionParser extends OptionParser {
-
- private final OptimizePhase optimizer;
- public boolean optimize;
-
- public OptimizeOptionParser(CommandParser command,
- String option, String description, OptimizePhase optimizer)
- {
- super(command, option, description);
- this.optimizer = optimizer;
- this.optimize = false;
- }
-
- public boolean matches(String[] args, int index) {
- return args[index].equals("-" + option);
- }
-
- public int consume(String[] args, int index) {
- optimizer.setOptions(args[index].substring(1 + option.length()));
- optimize = true;
- return index + 1;
- }
-
- public String getHelpSyntax() {
- return super.getHelpSyntax() + "[:<options>]";
- }
-}
-*/
-public class VersionOptionParser extends OptionParser {
-
- private final String version;
-
- public VersionOptionParser(CommandParser command,
- String option, String description, String version)
- {
- super(command, option, description);
- this.version = version;
- }
-
- public boolean matches(String[] args, int index) {
- return args[index].equals("-" + option);
- }
-
- public int consume(String[] args, int index) {
- System.out.println(version);
- System.exit(0);
- return index + 1;
- }
-}
-
-public class HelpOptionParser extends OptionParser {
-
- public HelpOptionParser(CommandParser command,
- String option, String description)
- {
- super(command, option, description);
- }
-
- public boolean matches(String[] args, int index) {
- return args[index].equals("-?") ||
- args[index].equals("-" + option) ||
- args[index].equals("--" + option);
- }
-
- public int consume(String[] args, int index) {
- System.out.println(command.getHelpMessage());
- System.exit(0);
- return index + 1;
- }
-
- public String getHelpSyntax() {
- return "-? " + super.getHelpSyntax();
- }
-}
-
-public class UnknownOptionParser extends OptionParser {
-
- public UnknownOptionParser(CommandParser command) {
- super(command, "", null);
- }
-
- public boolean matches(String[] args, int index) {
- return args[index].startsWith("-");
- }
-
- public int consume(String[] args, int index) {
- command.error("unknown option " + args[index]);
- return index + 1;
- }
-}
-
-public class BooleanOptionParser extends OptionParser {
-
- public boolean value;
-
- public BooleanOptionParser(CommandParser command,
- String option, String description, boolean value)
- {
- super(command, option, description);
- this.value = value;
- }
-
- public boolean matches(String[] args, int index) {
- return args[index].equals("-" + option);
- }
-
- public int consume(String[] args, int index) {
- value = true;
- return index + 1;
- }
-}
-
-public class StringOptionParser extends OptionParser {
-
- public String value;
- public String argument;
-
- public StringOptionParser(CommandParser command,
- String option, String description, String argument, String value)
- {
- super(command, option, description);
- this.argument = argument;
- this.value = value;
- }
-
- public boolean matches(String[] args, int index) {
- return args[index].equals("-" + option);
- }
-
- public int consume(String[] args, int index) {
- if (index + 1 < args.length) {
- value = args[index + 1];
- return index + 2;
- } else {
- error("missing argument");
- return index + 1;
- }
- }
-
- public String getHelpSyntax() {
- String syntax = super.getHelpSyntax();
- if (argument != null) syntax = syntax + " <" + argument + ">";
- return syntax;
- }
-}
-
-public class PhaseSetOptionParser extends OptionParser {
-
- private final PhaseDescriptor[] phases;
- private final int flag;
- private final PrefixMatcher matcher;
-
- public PhaseSetOptionParser(CommandParser command,
- String option, String description, PhaseDescriptor[] phases, int flag)
- {
- super(command, option, description);
- this.phases = phases;
- this.flag = flag;
- this.matcher = new PrefixMatcher();
- for (int i = 0; i < phases.length; i++) {
- PhaseDescriptor phase = phases[i];
- matcher.insert(phase.name(), phase, phase.description());
- }
- }
-
- public boolean matches(String[] args, int index) {
- return args[index].startsWith("-" + option + ":");
- }
-
- public int consume(String[] args, int index) {
- StringTokenizer tokens = new StringTokenizer(
- args[index].substring(option.length() + 2), ",");
- while (tokens.hasMoreTokens()) consumePhase(tokens.nextToken());
- return index + 1;
- }
-
- public void consumePhase(String token) {
- if (token.equals("all")) {
- for (int i = 0; i < phases.length; i++)
- phases[i].addFlag(flag, false);
- return;
- }
- PhaseDescriptor phase = lookup(getPhaseName(token));
- if (phase != null) {
- boolean before = getBeforeFlag(token);
- boolean after = getAfterFlag(token) || !before;
- if (before) phase.addFlag(flag, true);
- if (after) phase.addFlag(flag, false);
- }
- }
-
- public PhaseDescriptor lookup(String name) {
- if (name.length() == 0) {
- error("illegal zero-length phase name");
- return null;
- }
- PrefixMatcher.Entry[] entries = matcher.lookup(name);
- if (entries.length == 1) return (PhaseDescriptor)entries[0].value;
- error(matcher.getErrorMessage(name, entries, "phase name"));
- return null;
- }
-
- public boolean getBeforeFlag(String token) {
- for (int i = token.length(); 0 < i--; ) {
- switch (token.charAt(i)) {
- case '-': return true;
- case '+': continue;
- default : return false;
- }
- }
- return false;
- }
-
- public boolean getAfterFlag(String token) {
- for (int i = token.length(); 0 < i--; ) {
- switch (token.charAt(i)) {
- case '-': continue;
- case '+': return true;
- default : return false;
- }
- }
- return false;
- }
-
- public String getPhaseName(String token) {
- for (int i = token.length(); 0 < i--; ) {
- switch (token.charAt(i)) {
- case '-': continue;
- case '+': continue;
- default : return token.substring(0, i + 1);
- }
- }
- return "";
- }
-
- public String getHelpSyntax() {
- return super.getHelpSyntax() + ":<phases>";
- }
-}
-
-public class PrintOptionParser extends PhaseSetOptionParser {
-
- public boolean tokens;
-
- public PrintOptionParser(CommandParser command,
- String option, String description, PhaseDescriptor[] phases, int flag)
- {
- super(command, option, description, phases, flag);
- this.tokens = false;
- }
-
- public void consumePhase(String token) {
- if ("tokens".equals(token))
- tokens = true;
- else
- super.consumePhase(token);
- }
-
-}
-
-public class ChoiceOptionParser extends OptionParser {
-
- public final String argument;
- public final String[] choices;
-
- public String value;
-
- public ChoiceOptionParser(CommandParser command,
- String option, String description, String argument, String[] choices,
- String value)
- {
- super(command, option, description);
- this.argument = argument;
- this.choices = choices;
- this.value = value;
- }
-
- public boolean matches(String[] args, int index) {
- return args[index].startsWith("-" + option + ":");
- }
-
- public int consume(String[] args, int index) {
- String choice = args[index].substring(option.length() + 2);
- boolean found = false;
- for (int i = 0; i < choices.length; i++) {
- if (choices[i].equals(choice)) { found = true; break; }
- }
- if (found) {
- value = choice;
- } else if (choice.length() > 0) {
- error("unknown " + argument + " '" + choice + "'");
- } else {
- error("missing " + argument);
- }
- return index + 1;
- }
-
- public String getHelpSyntax() {
- String syntax = super.getHelpSyntax();
- if (argument != null) syntax = syntax + ":<" + argument + ">";
- return syntax;
- }
-}
diff --git a/sources/scalac/util/PrefixMatcher.java b/sources/scalac/util/PrefixMatcher.java
deleted file mode 100644
index 1b0acd8d7a..0000000000
--- a/sources/scalac/util/PrefixMatcher.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
-
-public class PrefixMatcher {
-
- public static class Entry {
-
- private Entry prev;
- private Entry next;
-
- public final String key;
- public final Object value;
- public final String argument;
- public final String description;
-
- public Entry(String key, Object value, String argument,
- String description)
- {
- this.key = key;
- this.value = value;
- this.argument = argument;
- this.description = description;
- }
- }
-
- private final Map entries;
- private Entry first;
- private Entry last;
-
- public PrefixMatcher() {
- this.entries = new HashMap();
- }
-
- public void insert(String key, Object value) {
- insert(key, value, null, null);
- }
-
- public void insert(String key, Object value, String description) {
- insert(key, value, null, description);
- }
-
- public void insert(String key, Object value, String argument,
- String description)
- {
- assert key != null && !entries.containsKey(key) : key;
- Entry entry = new Entry(key, value, argument, description);
- if (first == null) {
- first = last = entry;
- } else {
- last.next = entry;
- entry.prev = last;
- last = entry;
- }
- entries.put(key, entry);
- }
-
- public Entry[] lookup(String key) {
- Object value = entries.get(key);
- if (value != null) return new Entry[] { (Entry)value };
- List list = new ArrayList();
- for (Entry i = first; i != null; i = i.next) {
- if (i.key.startsWith(key)) list.add(i);
- }
- return (Entry[])list.toArray(new Entry[list.size()]);
- }
-
- public String getErrorMessage(String key, Entry[] entries, String what) {
- switch (entries.length) {
- case 0:
- return "unknown " + what + " '" + key + "'";
- case 1:
- return null;
- case 2:
- return "ambigous " + what + " '" + key + "', both '" +
- entries[0].key + "' and '" + entries[1].key + "' match";
- default:
- StringBuffer buffer = new StringBuffer();
- buffer.append("ambigous ").append(what);
- buffer.append(" '").append(key).append("'");
- for (int i = 0; i < entries.length; i++) {
- buffer.append(i < entries.length - 1 ? ", " : " and ");
- buffer.append('\'').append(entries[i].key).append('\'');
- }
- buffer.append(" match");
- return buffer.toString();
- }
- }
-
- public List getHelpStrings(String separator1, String separator2) {
- List strings = new ArrayList();
- for (Entry entry = first; entry != null; entry = entry.next) {
- if (entry.description != null)
- if (entry.argument != null)
- strings.add(entry.key + separator1 + entry.argument +
- separator2 + entry.description);
- else
- strings.add(entry.key + separator2 + entry.description);
- }
- return strings;
- }
-
-}
diff --git a/sources/scalac/util/SourceRepresentation.java b/sources/scalac/util/SourceRepresentation.java
deleted file mode 100644
index 83c1372769..0000000000
--- a/sources/scalac/util/SourceRepresentation.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-import java.io.File;
-
-import scalac.symtab.Symbol;
-import scalac.symtab.SymbolNameWriter;
-
-public final class SourceRepresentation {
-
- /** The file name writer */
- private static SymbolNameWriter fileNameWriter = new SymbolNameWriter()
- .setAllSeparators(File.separatorChar)
- .setRootSeparator('\0');
-
- public static int digit2int(char ch, int base) {
- if ('0' <= ch && ch <= '9' && ch < '0' + base)
- return ch - '0';
- else if ('A' <= ch && ch < 'A' + base - 10)
- return ch - 'A' + 10;
- else if ('a' <= ch && ch < 'a' + base - 10)
- return ch - 'a' + 10;
- else
- return -1;
- }
-
- public static byte int2digit(int x) {
- if (x <= 9)
- return (byte)(x + '0');
- else
- return (byte)(x - 10 + 'A');
- }
-
-/* the next 4 functions convert between three fundamental name
- * representations:
- * - string each character 16 bit,
- * - source characters outside 0..127 are represented by
- * unicode escapes, \ u X X X X
- * - ascii characters outside 0..127 are represented by two or three
- * byte sequences with high bit set (as in class file format).
- */
-
-/** 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;
- int i = 0;
- while (i < len) {
- if (source[offset + i] == '\\' && i + 1 < len) {
- i++;
- switch (source[offset + i]) {
- case 'n':
- ascii[j++] = (byte)'\n'; i++; continue;
- case 't':
- ascii[j++] = (byte)'\t'; i++; continue;
- case 'b':
- ascii[j++] = (byte)'\b'; i++; continue;
- case 'r':
- ascii[j++] = (byte)'\r'; i++; continue;
- case 'f':
- ascii[j++] = (byte)'\f'; i++; continue;
- case 'u':
- if (i + 4 < len) {
- int code = 0;
- int k = 1;
- int d = 0;
- while (k <= 4 && d >= 0) {
- // !!! (char)
- d = digit2int((char)source[offset + i + k], 16);
- code = code * 16 + d;
- k++;
- }
- if (d >= 0) {
- if (code <= 0x7F)
- ascii[j++] = (byte)code;
- else
- if (code <= 0x3FF) {
- ascii[j++] = (byte)(0xC0 | (code >> 6));
- ascii[j++] = (byte)(0x80 | (code & 0x3F));
- } else {
- ascii[j++] = (byte)(0xE0 | (code >> 12));
- ascii[j++] = (byte)(0x80 |
- ((code >> 6) & 0x3F));
- ascii[j++] = (byte)(0x80 | (code & 0x3F));
- }
- i = i + 5;
- continue;
- }
- }
- }
- }
- 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;
- }
-
-/** convert ascii bytes in ascii[offset..offset+len-1] to a string
- */
- public static String ascii2string(byte ascii[], int offset, int len) {
- char cs[] = new char[len];
- int i = offset;
- int j = 0;
- len += offset;
- while (i < len) {
- int b = ascii[i++] & 0xFF;
- if (b >= 0xE0) {
- b = ((b & 0x0F) << 12) | (ascii[i++] & 0x3F) << 6;
- b = b | (ascii[i++] & 0x3F);
- }
- else
- if (b >= 0xC0)
- b = ((b & 0x1F) << 6) | (ascii[i++] & 0x3F);
- cs[j++] = (char)b;
- }
- return new String(cs, 0, j);
- }
-
-/** 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++) {
- char ch = s.charAt(i);
- switch (ch) {
- case '\n':
- source[j++] = (byte)'\\';
- source[j++] = (byte)'n';
- break;
- case '\t':
- source[j++] = (byte)'\\';
- source[j++] = (byte)'t';
- break;
- case '\b':
- source[j++] = (byte)'\\';
- source[j++] = (byte)'b';
- break;
- case '\r':
- source[j++] = (byte)'\\';
- source[j++] = (byte)'r';
- break;
- case '\f':
- source[j++] = (byte)'\\';
- source[j++] = (byte)'f';
- break;
- case '\"':
- source[j++] = (byte)'\\';
- source[j++] = (byte)'\"';
- break;
- case '\'':
- source[j++] = (byte)'\\';
- source[j++] = (byte)'\'';
- break;
- case '\\':
- source[j++] = (byte)'\\';
- source[j++] = (byte)'\\';
- break;
- default:
- if ((' ' <= ch) && (ch <= 127))
- source[j++] = (byte)ch;
- else {
- source[j++] = (byte)'\\';
- source[j++] = (byte)'u';
- source[j++] = int2digit((ch >> 12) & 0xF);
- source[j++] = int2digit((ch >> 8) & 0xF);
- source[j++] = int2digit((ch >> 4) & 0xF);
- source[j++] = int2digit(ch & 0xF);
- }
- }
- }
- byte[] res = new byte[j];
- System.arraycopy(source, 0, res, 0, j);
- return res;
- }
-
-/** convert string to array of ascii bytes
- */
- 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];
- System.arraycopy(ascii, 0, res, 0, alen);
- return res;
- }
-
-/** escape all characters outside 32..127 in string s
- */
- public static String escape(String s) {
- try {
- return new String(string2source(s), "8859_1");
- } catch (java.io.UnsupportedEncodingException e) {
- throw new InternalError(e.getMessage());
- }
- }
-
-/** escape character c, if outside 32..127.
- */
- public static String escape(char c) {
- char[] s = {c};
- return escape(new String(s));
- }
-
- /**
- * Returns the external file name with given suffix associated to
- * given class. The file name use File.separatorChar as file
- * separator.
- */
- public static String externalizeFileName(Symbol clasz, String suffix) {
- assert clasz.isClassType(): Debug.show(clasz);
- return fileNameWriter.toString(clasz, suffix);
- }
-
-}
diff --git a/sources/scalac/util/Strings.java b/sources/scalac/util/Strings.java
deleted file mode 100644
index 8d5c1d85c5..0000000000
--- a/sources/scalac/util/Strings.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public abstract class Strings {
-
- //########################################################################
- // Strings constants
-
- final public static String[] EMPTY_ARRAY = new String[0];
-
- //########################################################################
- // Strings interface
-
- /** The line separator */
- public static String EOL = System.getProperty("line.separator", "\n");
-
- /** Returns a string where all tabs have been replaced by white
- * spaces to make the corresponding fields the same width.
- */
- public static String format(List strings) {
- List[] lines = new List[strings.size()];
- List widths = new ArrayList();
- int height = 0;
- for (Iterator iterator = strings.iterator(); iterator.hasNext(); ) {
- String string = (String)iterator.next();
- List line = lines[height++] = new ArrayList();
- for (int last = 0; last < string.length(); ) {
- int next = string.indexOf('\t', last);
- if (next < 0) next = string.length();
- String substring = string.substring(last, next);
- int index = line.size();
- if (index == widths.size()) widths.add(new Integer(0));
- int width = ((Integer)widths.get(index)).intValue();
- widths.set(
- index, new Integer(Math.max(width, substring.length())));
- line.add(substring);
- last = next + 1;
- }
- }
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < lines.length; i++) {
- List line = lines[i];
- for (int j = 0; true; j++) {
- String string = (String)line.get(j);
- buffer.append(string);
- if (j == line.size() - 1) break;
- int width = ((Integer)widths.get(j)).intValue();
- for (int k = string.length(); k<width; k++) buffer.append(' ');
- }
- buffer.append(EOL);
- }
- return buffer.toString();
- }
-
- /** Returns the first char of the string or -1 if the string is empty. */
- public static int firstChar(String string) {
- return string.length() == 0 ? -1 : string.charAt(0);
- }
-
- /** Returns the last char of the string or -1 if the string is empty. */
- public static int lastChar(String string) {
- return string.length() == 0 ? -1 : string.charAt(string.length() - 1);
- }
-
- /** Returns a copy of the string, with leading whitespace omitted. */
- public static String trimLeading(String string) {
- for (int i = 0; i < string.length(); i++)
- if (string.charAt(i) > ' ') return string.substring(i);
- return "";
- }
-
- /** Returns a copy of the string, with trailing whitespace omitted. */
- public static String trimTrailing(String string) {
- for (int i = string.length() - 1; i >= 0; i--)
- if (string.charAt(i) > ' ') return string.substring(0, i + 1);
- return "";
- }
-
- /** Returns the stack trace of the exception */
- public static String stackTrace(Throwable exception) {
- StringWriter buffer = new StringWriter();
- PrintWriter writer = new PrintWriter(buffer);
- exception.printStackTrace(writer);
- writer.close();
- return buffer.toString();
- }
-
- //########################################################################
-}
diff --git a/sources/scalac/util/TermName.java b/sources/scalac/util/TermName.java
deleted file mode 100644
index 8215a8ce2e..0000000000
--- a/sources/scalac/util/TermName.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-import java.util.HashMap;
-
-/** Instances of this class represent term names. */
-public final class TermName extends Name {
-
- //########################################################################
- // Private Variables
-
- /** Hashtable from string representation to term names. */
- private static HashMap/*<String,TermName>*/ strings = new HashMap();
-
- /** Hashtable from ASCII representation to term names. */
- private static TermName[] asciis = new TermName[0x00008000];
-
- //########################################################################
- // Private Fields
-
- /** The string representation */
- private final String string;
-
- /** The ASCII representation (null if not yet computed) */
- private byte[] ascii;
-
- /** The next name stored in the same bucket of the ASCII table */
- private TermName next;
-
- //########################################################################
- // Private Constructors
-
- /** Initializes this instance. */
- private TermName(String string) {
- super(2 * strings.size(), null);
- this.string = string;
- strings.put(string, this);
- }
-
- //########################################################################
- // Public Factories
-
- /** Returns the term name with given ASCII representation. */
- public static TermName fromAscii(byte[] bytes, int start, int count) {
- int index = hashValue(bytes, start, count) & (asciis.length - 1);
- for (TermName name = asciis[index]; name != null; name = name.next)
- if (name.equals(bytes, start, count)) return name;
- TermName name = fromString(
- SourceRepresentation.ascii2string(bytes, start, count));
- byte[] ascii = new byte[count];
- for (int i = 0; i < ascii.length; i++) ascii[i] = bytes[start + i];
- name.setAscii(ascii, index);
- return name;
- }
-
- /** Returns the term name with given string representation. */
- public static TermName fromString(String string) {
- Object value = strings.get(string);
- return value != null ? (TermName)value : new TermName(string);
- }
-
- //########################################################################
- // Public Methods
-
- /** Returns the string representation of this name. */
- public String toString() {
- return string;
- }
-
- /**
- * Returns the ASCII representation of this name. The returned
- * array is not a copy. Therefore, it is forbidden to modify it.
- */
- public byte[] toAsciiUnsafe() {
- if (ascii == null) {
- byte[] ascii = SourceRepresentation.string2ascii(string);
- int index = hashValue(ascii, 0, ascii.length) & (asciis.length-1);
- setAscii(ascii, index);
- }
- return ascii;
- }
-
- //########################################################################
- // Private Methods & Functions
-
- /** Sets the ASCII representation to given one. */
- private void setAscii(byte[] ascii, int index) {
- assert this.ascii == null: this;
- this.ascii = ascii;
- this.next = asciis[index];
- asciis[index] = this;
- }
-
- /** Is this name's ASCII representations equal to given one? */
- private boolean equals(byte[] bytes, int start, int count) {
- if (ascii.length != count) return false;
- for (int i = 0; i < count; i++)
- if (ascii[i] != bytes[start + i]) return false;
- return true;
- }
-
- /** Returns the hash code of the ASCII representation. */
- private static int hashValue(byte[] bytes, int start, int count) {
- if (count <= 0) return 0;
- return count * (41 * 41 * 41)
- + bytes[start] * (41 * 41)
- + bytes[start + count - 1] * 41
- + bytes[start + (count >> 1)];
- }
-
- //########################################################################
-}
diff --git a/sources/scalac/util/TypeName.java b/sources/scalac/util/TypeName.java
deleted file mode 100644
index cfe3b5193f..0000000000
--- a/sources/scalac/util/TypeName.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-/** Instances of this class represent type names. */
-public final class TypeName extends Name {
-
- //########################################################################
- // Protected Constructors
-
- /** Initializes this instance. */
- protected TypeName(TermName term) {
- super(term.index + 1, term);
- }
-
- //########################################################################
- // Public Factories
-
- /** Returns the type name with given ASCII representation. */
- public static TypeName fromAscii(byte[] bytes, int start, int count) {
- return TermName.fromAscii(bytes, start, count).toTypeName();
- }
-
- /** Returns the type name with given string representation. */
- public static TypeName fromString(String string) {
- return TermName.fromString(string).toTypeName();
- }
-
- //########################################################################
-}
diff --git a/sources/scalac/util/TypeNames.java b/sources/scalac/util/TypeNames.java
deleted file mode 100644
index 9f7fea1144..0000000000
--- a/sources/scalac/util/TypeNames.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
-// $Id$
-
-package scalac.util;
-
-public class TypeNames {
-
- public static final Name EMPTY = Names.EMPTY.toTypeName();
- public static final Name WILDCARD_STAR = Name.fromString("_*").toTypeName();
-
-}