mcimadamore@83: /*
mcimadamore@238: * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
mcimadamore@83: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@83: *
mcimadamore@83: * This code is free software; you can redistribute it and/or modify it
mcimadamore@83: * under the terms of the GNU General Public License version 2 only, as
mcimadamore@83: * published by the Free Software Foundation. Sun designates this
mcimadamore@83: * particular file as subject to the "Classpath" exception as provided
mcimadamore@83: * by Sun in the LICENSE file that accompanied this code.
mcimadamore@83: *
mcimadamore@83: * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@83: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@83: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@83: * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@83: * accompanied this code).
mcimadamore@83: *
mcimadamore@83: * You should have received a copy of the GNU General Public License version
mcimadamore@83: * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@83: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@83: *
mcimadamore@83: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
mcimadamore@83: * CA 95054 USA or visit www.sun.com if you need additional information or
mcimadamore@83: * have any questions.
mcimadamore@83: */
mcimadamore@83: package com.sun.tools.javac.util;
mcimadamore@83:
mcimadamore@221: import java.util.Arrays;
mcimadamore@83: import java.util.Collection;
mcimadamore@221: import java.util.EnumSet;
mcimadamore@221: import java.util.HashMap;
mcimadamore@83: import java.util.Locale;
mcimadamore@221: import java.util.Map;
mcimadamore@221: import java.util.Set;
mcimadamore@83: import javax.tools.JavaFileObject;
mcimadamore@83:
mcimadamore@83: import com.sun.tools.javac.api.DiagnosticFormatter;
mcimadamore@221: import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.DiagnosticPart;
mcimadamore@221: import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.MultilineLimit;
mcimadamore@221: import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind;
mcimadamore@83: import com.sun.tools.javac.api.Formattable;
mcimadamore@238: import com.sun.tools.javac.code.Printer;
mcimadamore@238: import com.sun.tools.javac.code.Symbol;
mcimadamore@238: import com.sun.tools.javac.code.Type;
mcimadamore@238: import com.sun.tools.javac.code.Type.CapturedType;
mcimadamore@83: import com.sun.tools.javac.file.JavacFileManager;
mcimadamore@221:
mcimadamore@137: import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
mcimadamore@83:
mcimadamore@83: /**
mcimadamore@83: * This abstract class provides a basic implementation of the functionalities that should be provided
mcimadamore@83: * by any formatter used by javac. Among the main features provided by AbstractDiagnosticFormatter are:
mcimadamore@83: *
mcimadamore@83: *
mcimadamore@83: * - Provides a standard implementation of the visitor-like methods defined in the interface DiagnisticFormatter.
mcimadamore@83: * Those implementations are specifically targeting JCDiagnostic objects.
mcimadamore@83: *
- Provides basic support for i18n and a method for executing all locale-dependent conversions
mcimadamore@83: *
- Provides the formatting logic for rendering the arguments of a JCDiagnostic object.
mcimadamore@83: *
mcimadamore@83: *
mcimadamore@83: */
mcimadamore@83: public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter {
mcimadamore@83:
mcimadamore@83: /**
mcimadamore@221: * JavacMessages object used by this formatter for i18n.
mcimadamore@83: */
mcimadamore@136: protected JavacMessages messages;
mcimadamore@238:
mcimadamore@238: /**
mcimadamore@238: * Configuration object used by this formatter
mcimadamore@238: */
mcimadamore@221: private SimpleConfiguration config;
mcimadamore@238:
mcimadamore@238: /**
mcimadamore@238: * Current depth level of the disgnostic being formatted
mcimadamore@238: * (!= 0 for subdiagnostics)
mcimadamore@238: */
mcimadamore@221: protected int depth = 0;
mcimadamore@83:
mcimadamore@83: /**
mcimadamore@238: * Printer instance to be used for formatting types/symbol
mcimadamore@238: */
mcimadamore@238: protected Printer printer;
mcimadamore@238:
mcimadamore@238: /**
mcimadamore@221: * Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object.
mcimadamore@83: * @param messages
mcimadamore@83: */
mcimadamore@221: protected AbstractDiagnosticFormatter(JavacMessages messages, SimpleConfiguration config) {
mcimadamore@83: this.messages = messages;
mcimadamore@221: this.config = config;
mcimadamore@238: this.printer = new FormatterPrinter();
mcimadamore@83: }
mcimadamore@83:
mcimadamore@83: public String formatKind(JCDiagnostic d, Locale l) {
mcimadamore@83: switch (d.getType()) {
mcimadamore@83: case FRAGMENT: return "";
mcimadamore@83: case NOTE: return localize(l, "compiler.note.note");
mcimadamore@83: case WARNING: return localize(l, "compiler.warn.warning");
mcimadamore@83: case ERROR: return localize(l, "compiler.err.error");
mcimadamore@83: default:
mcimadamore@83: throw new AssertionError("Unknown diagnostic type: " + d.getType());
mcimadamore@83: }
mcimadamore@83: }
mcimadamore@83:
mcimadamore@238: @Override
mcimadamore@238: public String format(JCDiagnostic d, Locale locale) {
mcimadamore@238: printer = new FormatterPrinter();
mcimadamore@238: return formatDiagnostic(d, locale);
mcimadamore@238: }
mcimadamore@238:
mcimadamore@238: abstract String formatDiagnostic(JCDiagnostic d, Locale locale);
mcimadamore@238:
mcimadamore@83: public String formatPosition(JCDiagnostic d, PositionKind pk,Locale l) {
mcimadamore@83: assert (d.getPosition() != Position.NOPOS);
mcimadamore@83: return String.valueOf(getPosition(d, pk));
mcimadamore@83: }
mcimadamore@221: //where
mcimadamore@221: private long getPosition(JCDiagnostic d, PositionKind pk) {
mcimadamore@83: switch (pk) {
mcimadamore@83: case START: return d.getIntStartPosition();
mcimadamore@83: case END: return d.getIntEndPosition();
mcimadamore@83: case LINE: return d.getLineNumber();
mcimadamore@83: case COLUMN: return d.getColumnNumber();
mcimadamore@83: case OFFSET: return d.getIntPosition();
mcimadamore@83: default:
mcimadamore@83: throw new AssertionError("Unknown diagnostic position: " + pk);
mcimadamore@83: }
mcimadamore@83: }
mcimadamore@83:
mcimadamore@100: public String formatSource(JCDiagnostic d, boolean fullname, Locale l) {
mcimadamore@83: assert (d.getSource() != null);
mcimadamore@100: return fullname ? d.getSourceName() : d.getSource().getName();
mcimadamore@83: }
mcimadamore@83:
mcimadamore@83: /**
mcimadamore@83: * Format the arguments of a given diagnostic.
mcimadamore@83: *
mcimadamore@83: * @param d diagnostic whose arguments are to be formatted
mcimadamore@83: * @param l locale object to be used for i18n
mcimadamore@83: * @return a Collection whose elements are the formatted arguments of the diagnostic
mcimadamore@83: */
mcimadamore@83: protected Collection formatArguments(JCDiagnostic d, Locale l) {
mcimadamore@83: ListBuffer buf = new ListBuffer();
mcimadamore@83: for (Object o : d.getArgs()) {
mcimadamore@83: buf.append(formatArgument(d, o, l));
mcimadamore@83: }
mcimadamore@83: return buf.toList();
mcimadamore@83: }
mcimadamore@83:
mcimadamore@83: /**
mcimadamore@83: * Format a single argument of a given diagnostic.
mcimadamore@83: *
mcimadamore@83: * @param d diagnostic whose argument is to be formatted
mcimadamore@83: * @param arg argument to be formatted
mcimadamore@83: * @param l locale object to be used for i18n
mcimadamore@83: * @return string representation of the diagnostic argument
mcimadamore@83: */
mcimadamore@83: protected String formatArgument(JCDiagnostic d, Object arg, Locale l) {
mcimadamore@221: if (arg instanceof JCDiagnostic) {
mcimadamore@221: String s = null;
mcimadamore@221: depth++;
mcimadamore@221: try {
mcimadamore@221: s = formatMessage((JCDiagnostic)arg, l);
mcimadamore@221: }
mcimadamore@221: finally {
mcimadamore@221: depth--;
mcimadamore@221: }
mcimadamore@221: return s;
mcimadamore@221: }
mcimadamore@83: else if (arg instanceof Iterable>) {
mcimadamore@83: return formatIterable(d, (Iterable>)arg, l);
mcimadamore@83: }
mcimadamore@238: else if (arg instanceof Type) {
mcimadamore@238: return printer.visit((Type)arg, l);
mcimadamore@238: }
mcimadamore@238: else if (arg instanceof Symbol) {
mcimadamore@238: return printer.visit((Symbol)arg, l);
mcimadamore@238: }
mcimadamore@238: else if (arg instanceof JavaFileObject) {
mcimadamore@83: return JavacFileManager.getJavacBaseFileName((JavaFileObject)arg);
mcimadamore@238: }
mcimadamore@238: else if (arg instanceof Formattable) {
mcimadamore@136: return ((Formattable)arg).toString(l, messages);
mcimadamore@238: }
mcimadamore@238: else {
mcimadamore@83: return String.valueOf(arg);
mcimadamore@238: }
mcimadamore@83: }
mcimadamore@83:
mcimadamore@83: /**
mcimadamore@83: * Format an iterable argument of a given diagnostic.
mcimadamore@83: *
mcimadamore@83: * @param d diagnostic whose argument is to be formatted
mcimadamore@83: * @param it iterable argument to be formatted
mcimadamore@83: * @param l locale object to be used for i18n
mcimadamore@83: * @return string representation of the diagnostic iterable argument
mcimadamore@83: */
mcimadamore@83: protected String formatIterable(JCDiagnostic d, Iterable> it, Locale l) {
mcimadamore@83: StringBuilder sbuf = new StringBuilder();
mcimadamore@83: String sep = "";
mcimadamore@83: for (Object o : it) {
mcimadamore@83: sbuf.append(sep);
mcimadamore@83: sbuf.append(formatArgument(d, o, l));
mcimadamore@83: sep = ",";
mcimadamore@83: }
mcimadamore@83: return sbuf.toString();
mcimadamore@83: }
mcimadamore@83:
mcimadamore@168: /**
mcimadamore@221: * Format all the subdiagnostics attached to a given diagnostic.
mcimadamore@168: *
mcimadamore@168: * @param d diagnostic whose subdiagnostics are to be formatted
mcimadamore@168: * @param l locale object to be used for i18n
mcimadamore@221: * @return list of all string representations of the subdiagnostics
mcimadamore@221: */
mcimadamore@221: protected List formatSubdiagnostics(JCDiagnostic d, Locale l) {
mcimadamore@221: List subdiagnostics = List.nil();
mcimadamore@221: int maxDepth = config.getMultilineLimit(MultilineLimit.DEPTH);
mcimadamore@221: if (maxDepth == -1 || depth < maxDepth) {
mcimadamore@221: depth++;
mcimadamore@221: try {
mcimadamore@221: int maxCount = config.getMultilineLimit(MultilineLimit.LENGTH);
mcimadamore@221: int count = 0;
mcimadamore@221: for (JCDiagnostic d2 : d.getSubdiagnostics()) {
mcimadamore@221: if (maxCount == -1 || count < maxCount) {
mcimadamore@221: subdiagnostics = subdiagnostics.append(formatSubdiagnostic(d, d2, l));
mcimadamore@221: count++;
mcimadamore@221: }
mcimadamore@221: else
mcimadamore@221: break;
mcimadamore@221: }
mcimadamore@221: }
mcimadamore@221: finally {
mcimadamore@221: depth--;
mcimadamore@221: }
mcimadamore@221: }
mcimadamore@221: return subdiagnostics;
mcimadamore@221: }
mcimadamore@221:
mcimadamore@221: /**
mcimadamore@221: * Format a subdiagnostics attached to a given diagnostic.
mcimadamore@221: *
mcimadamore@221: * @param parent multiline diagnostic whose subdiagnostics is to be formatted
mcimadamore@221: * @param sub subdiagnostic to be formatted
mcimadamore@221: * @param l locale object to be used for i18n
mcimadamore@168: * @return string representation of the subdiagnostics
mcimadamore@168: */
mcimadamore@221: protected String formatSubdiagnostic(JCDiagnostic parent, JCDiagnostic sub, Locale l) {
mcimadamore@221: return formatMessage(sub, l);
mcimadamore@168: }
mcimadamore@168:
mcimadamore@137: /** Format the faulty source code line and point to the error.
mcimadamore@137: * @param d The diagnostic for which the error line should be printed
mcimadamore@137: */
mcimadamore@221: protected String formatSourceLine(JCDiagnostic d, int nSpaces) {
mcimadamore@137: StringBuilder buf = new StringBuilder();
mcimadamore@137: DiagnosticSource source = d.getDiagnosticSource();
mcimadamore@137: int pos = d.getIntPosition();
mcimadamore@221: if (d.getIntPosition() == Position.NOPOS)
mcimadamore@221: throw new AssertionError();
mcimadamore@221: String line = (source == null ? null : source.getLine(pos));
mcimadamore@221: if (line == null)
mcimadamore@221: return "";
mcimadamore@221: buf.append(indent(line, nSpaces));
mcimadamore@221: int col = source.getColumnNumber(pos, false);
mcimadamore@221: if (config.isCaretEnabled()) {
mcimadamore@221: buf.append("\n");
mcimadamore@137: for (int i = 0; i < col - 1; i++) {
mcimadamore@137: buf.append((line.charAt(i) == '\t') ? "\t" : " ");
mcimadamore@137: }
mcimadamore@221: buf.append(indent("^", nSpaces));
mcimadamore@221: }
mcimadamore@221: return buf.toString();
mcimadamore@137: }
mcimadamore@137:
mcimadamore@83: /**
mcimadamore@221: * Converts a String into a locale-dependent representation accordingly to a given locale.
mcimadamore@83: *
mcimadamore@83: * @param l locale object to be used for i18n
mcimadamore@83: * @param key locale-independent key used for looking up in a resource file
mcimadamore@83: * @param args localization arguments
mcimadamore@83: * @return a locale-dependent string
mcimadamore@83: */
mcimadamore@83: protected String localize(Locale l, String key, Object... args) {
mcimadamore@136: return messages.getLocalizedString(l, key, args);
mcimadamore@83: }
mcimadamore@137:
mcimadamore@137: public boolean displaySource(JCDiagnostic d) {
mcimadamore@221: return config.getVisible().contains(DiagnosticPart.SOURCE) &&
mcimadamore@221: d.getType() != FRAGMENT &&
mcimadamore@221: d.getIntPosition() != Position.NOPOS;
mcimadamore@137: }
mcimadamore@168:
mcimadamore@168: /**
mcimadamore@168: * Creates a string with a given amount of empty spaces. Useful for
mcimadamore@168: * indenting the text of a diagnostic message.
mcimadamore@168: *
mcimadamore@168: * @param nSpaces the amount of spaces to be added to the result string
mcimadamore@168: * @return the indentation string
mcimadamore@168: */
mcimadamore@168: protected String indentString(int nSpaces) {
mcimadamore@168: String spaces = " ";
mcimadamore@168: if (nSpaces <= spaces.length())
mcimadamore@168: return spaces.substring(0, nSpaces);
mcimadamore@168: else {
mcimadamore@168: StringBuilder buf = new StringBuilder();
mcimadamore@168: for (int i = 0 ; i < nSpaces ; i++)
mcimadamore@168: buf.append(" ");
mcimadamore@168: return buf.toString();
mcimadamore@168: }
mcimadamore@168: }
mcimadamore@168:
mcimadamore@168: /**
mcimadamore@168: * Indent a string by prepending a given amount of empty spaces to each line
mcimadamore@221: * of the string.
mcimadamore@168: *
mcimadamore@168: * @param s the string to be indented
mcimadamore@168: * @param nSpaces the amount of spaces that should be prepended to each line
mcimadamore@168: * of the string
mcimadamore@168: * @return an indented string
mcimadamore@168: */
mcimadamore@168: protected String indent(String s, int nSpaces) {
mcimadamore@168: String indent = indentString(nSpaces);
mcimadamore@168: StringBuilder buf = new StringBuilder();
mcimadamore@168: String nl = "";
mcimadamore@168: for (String line : s.split("\n")) {
mcimadamore@168: buf.append(nl);
mcimadamore@168: buf.append(indent + line);
mcimadamore@168: nl = "\n";
mcimadamore@168: }
mcimadamore@168: return buf.toString();
mcimadamore@168: }
mcimadamore@221:
mcimadamore@221: public SimpleConfiguration getConfiguration() {
mcimadamore@221: return config;
mcimadamore@221: }
mcimadamore@221:
mcimadamore@221: static public class SimpleConfiguration implements Configuration {
mcimadamore@221:
mcimadamore@221: protected Map multilineLimits;
mcimadamore@221: protected EnumSet visibleParts;
mcimadamore@221: protected boolean caretEnabled;
mcimadamore@221:
mcimadamore@221: public SimpleConfiguration(Set parts) {
mcimadamore@221: multilineLimits = new HashMap();
mcimadamore@221: setVisible(parts);
mcimadamore@221: setMultilineLimit(MultilineLimit.DEPTH, -1);
mcimadamore@221: setMultilineLimit(MultilineLimit.LENGTH, -1);
mcimadamore@221: setCaretEnabled(true);
mcimadamore@221: }
mcimadamore@221:
mcimadamore@221: @SuppressWarnings("fallthrough")
mcimadamore@221: public SimpleConfiguration(Options options, Set parts) {
mcimadamore@221: this(parts);
mcimadamore@221: String showSource = null;
mcimadamore@221: if ((showSource = options.get("showSource")) != null) {
mcimadamore@221: if (showSource.equals("true"))
mcimadamore@221: visibleParts.add(DiagnosticPart.SOURCE);
mcimadamore@221: else if (showSource.equals("false"))
mcimadamore@221: visibleParts.remove(DiagnosticPart.SOURCE);
mcimadamore@221: }
mcimadamore@221: String diagOpts = options.get("diags");
mcimadamore@221: if (diagOpts != null) {//override -XDshowSource
mcimadamore@221: Collection args = Arrays.asList(diagOpts.split(","));
mcimadamore@221: if (args.contains("short")) {
mcimadamore@221: visibleParts.remove(DiagnosticPart.DETAILS);
mcimadamore@221: visibleParts.remove(DiagnosticPart.SUBDIAGNOSTICS);
mcimadamore@221: }
mcimadamore@221: if (args.contains("source"))
mcimadamore@221: visibleParts.add(DiagnosticPart.SOURCE);
mcimadamore@221: if (args.contains("-source"))
mcimadamore@221: visibleParts.remove(DiagnosticPart.SOURCE);
mcimadamore@221: }
mcimadamore@221: String multiPolicy = null;
mcimadamore@221: if ((multiPolicy = options.get("multilinePolicy")) != null) {
mcimadamore@221: if (multiPolicy.equals("disabled"))
mcimadamore@221: visibleParts.remove(DiagnosticPart.SUBDIAGNOSTICS);
mcimadamore@221: else if (multiPolicy.startsWith("limit:")) {
mcimadamore@221: String limitString = multiPolicy.substring("limit:".length());
mcimadamore@221: String[] limits = limitString.split(":");
mcimadamore@221: try {
mcimadamore@221: switch (limits.length) {
mcimadamore@221: case 2: {
mcimadamore@221: if (!limits[1].equals("*"))
mcimadamore@221: setMultilineLimit(MultilineLimit.DEPTH, Integer.parseInt(limits[1]));
mcimadamore@221: }
mcimadamore@221: case 1: {
mcimadamore@221: if (!limits[0].equals("*"))
mcimadamore@221: setMultilineLimit(MultilineLimit.LENGTH, Integer.parseInt(limits[0]));
mcimadamore@221: }
mcimadamore@221: }
mcimadamore@221: }
mcimadamore@221: catch(NumberFormatException ex) {
mcimadamore@221: setMultilineLimit(MultilineLimit.DEPTH, -1);
mcimadamore@221: setMultilineLimit(MultilineLimit.LENGTH, -1);
mcimadamore@221: }
mcimadamore@221: }
mcimadamore@221: }
mcimadamore@221: String showCaret = null;
mcimadamore@221: if (((showCaret = options.get("showCaret")) != null) &&
mcimadamore@221: showCaret.equals("false"))
mcimadamore@221: setCaretEnabled(false);
mcimadamore@221: else
mcimadamore@221: setCaretEnabled(true);
mcimadamore@221: }
mcimadamore@221:
mcimadamore@221: public int getMultilineLimit(MultilineLimit limit) {
mcimadamore@221: return multilineLimits.get(limit);
mcimadamore@221: }
mcimadamore@221:
mcimadamore@221: public EnumSet getVisible() {
mcimadamore@221: return EnumSet.copyOf(visibleParts);
mcimadamore@221: }
mcimadamore@221:
mcimadamore@221: public void setMultilineLimit(MultilineLimit limit, int value) {
mcimadamore@221: multilineLimits.put(limit, value < -1 ? -1 : value);
mcimadamore@221: }
mcimadamore@221:
mcimadamore@221:
mcimadamore@221: public void setVisible(Set diagParts) {
mcimadamore@221: visibleParts = EnumSet.copyOf(diagParts);
mcimadamore@221: }
mcimadamore@221:
mcimadamore@221: /**
mcimadamore@221: * Shows a '^' sign under the source line displayed by the formatter
mcimadamore@221: * (if applicable).
mcimadamore@221: *
mcimadamore@221: * @param caretEnabled if true enables caret
mcimadamore@221: */
mcimadamore@221: public void setCaretEnabled(boolean caretEnabled) {
mcimadamore@221: this.caretEnabled = caretEnabled;
mcimadamore@221: }
mcimadamore@221:
mcimadamore@221: /**
mcimadamore@221: * Tells whether the caret display is active or not.
mcimadamore@221: *
mcimadamore@221: * @param caretEnabled if true the caret is enabled
mcimadamore@221: */
mcimadamore@221: public boolean isCaretEnabled() {
mcimadamore@221: return caretEnabled;
mcimadamore@221: }
mcimadamore@221: }
mcimadamore@238:
mcimadamore@238: /**
mcimadamore@238: * An enhanced printer for formatting types/symbols used by
mcimadamore@238: * AbstractDiagnosticFormatter. Provides alternate numbering of captured
mcimadamore@238: * types (they are numbered starting from 1 on each new diagnostic, instead
mcimadamore@238: * of relying on the underlying hashcode() method which generates unstable
mcimadamore@238: * output). Also detects cycles in wildcard messages (e.g. if the wildcard
mcimadamore@238: * type referred by a given captured type C contains C itself) which might
mcimadamore@238: * lead to infinite loops.
mcimadamore@238: */
mcimadamore@238: protected class FormatterPrinter extends Printer {
mcimadamore@238:
mcimadamore@238: List allCaptured = List.nil();
mcimadamore@238: List seenCaptured = List.nil();
mcimadamore@238:
mcimadamore@238: @Override
mcimadamore@238: protected String localize(Locale locale, String key, Object... args) {
mcimadamore@238: return AbstractDiagnosticFormatter.this.localize(locale, key, args);
mcimadamore@238: }
mcimadamore@238:
mcimadamore@238: @Override
mcimadamore@238: public String visitCapturedType(CapturedType t, Locale locale) {
mcimadamore@238: if (seenCaptured.contains(t))
mcimadamore@238: return localize(locale, "compiler.misc.type.captureof.1",
mcimadamore@238: allCaptured.indexOf(t) + 1);
mcimadamore@238: else {
mcimadamore@238: try {
mcimadamore@238: seenCaptured = seenCaptured.prepend(t);
mcimadamore@238: allCaptured = allCaptured.append(t);
mcimadamore@238: return localize(locale, "compiler.misc.type.captureof",
mcimadamore@238: allCaptured.indexOf(t) + 1,
mcimadamore@238: visit(t.wildcard, locale));
mcimadamore@238: }
mcimadamore@238: finally {
mcimadamore@238: seenCaptured = seenCaptured.tail;
mcimadamore@238: }
mcimadamore@238: }
mcimadamore@238: }
mcimadamore@238: }
mcimadamore@83: }