Debian Codegraph @

rhino/src/org/mozilla/javascript/ast/IdeErrorReporter.java

raw symbols SCIP
1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 // API class
8
9 package org.mozilla.javascript.ast;
10
11 import org.mozilla.javascript.ErrorReporter;
12
13 /**
14 * This is interface defines a protocol for the reporting of
15 * errors during JavaScript translation in IDE-mode.
16 * If the {@link org.mozilla.javascript.Parser}'s error reporter is
17 * set to an instance of this interface, then this interface's
18 * {@link #warning} and {@link #error} methods are called instead
19 * of the {@link org.mozilla.javascript.ErrorReporter} versions. <p>
20 *
21 * These methods take a source char offset and a length. The
22 * rationale is that in interactive IDE-type environments, the source
23 * is available and the IDE will want to indicate where the error
24 * occurred and how much code participates in it. The start and length
25 * are generally chosen to fit within a single line, for readability,
26 * but the client is free to use the AST to determine the affected
27 * node(s) from the start position and change the error or warning's
28 * display bounds.<p>
29 *
30 * @author Steve Yegge
31 */
32 public interface IdeErrorReporter extends ErrorReporter {
33
34 /**
35 * Report a warning.<p>
36 *
37 * The implementing class may choose to ignore the warning
38 * if it desires.
39 *
40 * @param message a {@code String} describing the warning
41 * @param sourceName a {@code String} describing the JavaScript source
42 * where the warning occured; typically a filename or URL
43 * @param offset the warning's 0-indexed char position in the input stream
44 * @param length the length of the region contributing to the warning
45 */
46 void warning(String message, String sourceName, int offset, int length);
47
48 /**
49 * Report an error.<p>
50 *
51 * The implementing class is free to throw an exception if
52 * it desires.<p>
53 *
54 * If execution has not yet begun, the JavaScript engine is
55 * free to find additional errors rather than terminating
56 * the translation. It will not execute a script that had
57 * errors, however.<p>
58 *
59 * @param message a String describing the error
60 * @param sourceName a String describing the JavaScript source
61 * where the error occured; typically a filename or URL
62 * @param offset 0-indexed char position of the error in the input stream
63 * @param length the length of the region contributing to the error
64 */
65 void error(String message, String sourceName, int offset, int length);
66 }